Click to See Complete Forum and Search --> : Please help with onmouseover and image maps!


alex80it
03-10-2003, 07:52 AM
Greetings, All!

I am new to JavaScript, but I already love it! It just allowed me to do what I was trying to do via Applet saving a huge lot of trouble and loading time!
However, I still have one little problem!
I want to display different messages on the status bar, depending where the mouse is withing an image map. I have the image map created alright, and I know how to use the standard onmouseover event handler when I dela with common <a> links. When I try to use it on the parts of the <map> element, however, my message on the status bar get replaced by the map piece's url nonetheless.
Is there a way I can make my message show, instead of the url?

Thanks a lot in advance!

Alex

Nicodemas
03-10-2003, 08:30 AM
try this onMouseover:


onMouseover="window.status='something something';return true;"

alex80it
03-10-2003, 10:36 AM
Thanx Nicodemas, but I had tried that already, and it only works when the links are normal <a> tags... I even put the return true;
The code I need help with is something like:
<map name="MyMap">
<area shape="poly" coords="1,7,20,0,24,6,28,2,37,2,43,14,44,31,84,31,84,44,27,44,1,39" href="www.myLink.com">
</map>

I need to have the area put a message in the status bar when the user passes the mouse over it, but if I just put the code
onmouseover="status='Message';return true;"
in the <area ...> tag, all I get is a flip of the message before it gets replaced y the url www.myLink.com
Is there anyway to override that url?
That is what I need to know!
Still many thx for the help, hope you also know the answer to this one!

Alex

gil davis
03-10-2003, 11:27 AM
What browser?

alex80it
03-10-2003, 02:43 PM
I'm testing my website with IE6
It's supposed to work everywhere, at least that's my intention...
I read somewhere that I ought not to use image maps to do this, but a compositon of images... This looks to me rather a heavy compromise, though, beacuse my images don't have rectangular borders...

Alex

joeys1
03-11-2003, 04:58 PM
Hey there.

I am a newbie to these forums, but have been poking around in Javascript for awhile, so I thought I'd register and see if I could help someone.

In response to your query, I scratched up an imagemap and just inserted onMouseOver and onMouseOut statements into the <area> tags of the image maps, and things went properly. I am using Mozilla / Opera / NS7.

Just for reference, my code was:

<area shape="rect" coords="4,35,155,72" href="surf_detail.html" onMouseOver="window.status='Surfing!'; return true;" onMouseOut="window.status=''; return true;" alt="surfing" title="surfing">

If that is what your source code looks like, can you post up the appropriate bits, and I'll see if I can be a 2nd pair of eyes:D