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

mouseover/img map problem
Is there a js programmer around?

 2:09 pm on Apr 14, 2003 (gmt 0)

Hello all

I have a problem with this script. I've searched all over for the correct syntax to fit this type of script with no success. I can't see what's up with it. Can you help?

It's to do with syntax, not the map tags or any other thing that obvious. I've been swapping tags around and this is whjere I've had enough of it.

The script:
<title>Image swap</title>
<script language="JavaScript" type="text/javascript">
<!-- hide
   net0=new Image();
   cell=new Image();
jack=new Image();
max=new Image();
simm=new Image();
else {
function myVoid() {;}
// end hide --> </script>

<a href="javascript:myVoid" onMouseover="document.button.src=cell.src" onMouseout="document.button.src=net0.src">
<img src="images/net0.gif" width="408" height="360" border="0" usemap="#thismap"
<map name="thismap"><area alt="netcel" coords="22,100,92,130">

<area alt="netcel" coords="320,187,400,211" href="javascript:blank()"
onMouseover="document.button.src=cell.src" onMouseout="document.button.src=net0.src">

<area alt="netcel" coords="48,276,124,303" href="javascript:blank()"
onMouseover="document.button.src=cell.src" onMouseout="document.button.src=net0.src">

<area alt="netcel" coords="256,282,334,310" href="javascript:blank()"
onMouseover="document.button.src=cell.src" onMouseout="document.button.src=net0.src">





 2:16 pm on Apr 14, 2003 (gmt 0)

Which browser causes you problems?


 2:19 pm on Apr 14, 2003 (gmt 0)

And, actually, what exactly is the problem? :)


 2:30 pm on Apr 14, 2003 (gmt 0)

DrDoc is right that symptoms would make it easier to diagnose. In the absense of those... my first suggestion would be to change some of the variable names so they don't overide built-in elements. The two I can spot are:

max() is a Javascript function
<button> is an html tag.



 2:46 pm on Apr 14, 2003 (gmt 0)

a href="javascript:myVoid"

Try javascript:void(); or if you want to use your function javascript:myVoid();.

Also, use only type="text/javascript" - the language attribute is deprecated.

ShawnR got the other possible problems, and DrDoc is spot on - without the symptoms we are just guessing!


 2:41 am on Apr 15, 2003 (gmt 0)

the symptoms are:

The mouseover simply isnt working. Though it did click it would not mouseover.

In short, nothing happens when I mouseover. (But strange that it will click to the swap image).

Im using IE5.1 and a Mac. But I can mouseover elsewhere so i assume it isnt the browser. I'll make the changes suggested to see if there is any fix in this, and post a reply


 3:24 am on Apr 15, 2003 (gmt 0)

I know you said that it wasn't the image map, but the code you posted has two </map> tags - the image map is being closed too soon.

In general the combination of image maps and mouseover behavior is a gnarly one. Why not slice your image and do straightforard anchor tags with mouseovers?


 1:08 pm on Apr 15, 2003 (gmt 0)

thanks for all your help.

I fixed this after discovering the document.path wasnt working (on IE/Mac at least).

If anyone wants to see this finished i can sticky it.

There may be other changes ive made in this script.

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