Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Clickable images

Posted on 1997-03-11
1
Medium Priority
?
566 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 100 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

972 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