Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Clickable images

Posted on 1997-03-11
1
Medium Priority
?
561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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-…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

730 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