homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

image map javascript onclick event not working

 3:02 pm on Sep 22, 2011 (gmt 0)

hi i have tried a simple onclick event on image map but was not functioning ,i can't able to figure it out.

<script type="text/javascript">
function Get(What)
{ alert(What); }


<map name="Map" id="Map">
<area shape="rect" coords="356,160,364,168" href="#" onclick="Get(6);" alt="this is city area" />



 4:28 pm on Sep 22, 2011 (gmt 0)

Map before closing body tag?
Are you sure the coords are correct, and you're correctly referencing the map? The cursor should turn into a pointer when moused over.

<img src="someimage.jpg" usemap="#Map" alt="imagemap">

Remembering that map and Map are not the same thing . . .

Also if you've made this error,

<p id="Map"><img src="someimage.jpg" usemap="#Map" alt="imagemap"></p>

ID's must be unique, rename one or the other. Also when you get it working you might want to make these two changes:

function Get(What)
{ alert(What); return false; }

<map name="Map" id="Map">
<area shape="rect" coords="356,160,364,168" href="#" onclick="return Get(6);" alt="this is city area" />

.. so the page doesn't navigate to the top.


 8:19 am on Sep 23, 2011 (gmt 0)

i have taken care of things u have mentioned now sometimes get popup and sometime i don't on click of image map,
how to set popup very next to image map .


 5:01 am on Sep 25, 2011 (gmt 0)

i have manage to get popup next to hot spot now my problem is its showing in IE -7 and above but not in firefox and Chrome

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved