Solved

Clickable images

Posted on 1997-03-11
1
544 Views
Last Modified: 2010-05-18
I want be able to click an image had have it perform a
Javascript function.  The IMG tag, however, has no onClick
event handler.  I've tried using imagemaps and links, and neither works.  Is there anyway to do this?
0
Comment
Question by:schudson
1 Comment
 
LVL 5

Accepted Solution

by:
Trevor013097 earned 50 total points
ID: 1264911
To get this to work you simply need to add an onClick to your HREF command which will then call your Javascript function.  To make any image clickable it must be within an HREF tagset under HTML.

Try the following:-

<A HREF="" onClick="yourfunction()"><IMG SRC="imagename.gif"></A>

Hope this helps
Any problems, mail me
tmunday@pcmaritime.co.uk
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question