...

View Full Version : Opera imagemap hotspot



Mr J
01-06-2007, 02:59 PM
How do you dynamically assign a hotspot in Opera

I can do it in IE7, Mozilla, Firefoz. NS8 simply by creating another map with new co-ordinates and then assigning to the new map name to the imgMap attribute.

Opera does nothing, not even an error message

Arty Effem
01-06-2007, 08:43 PM
How do you dynamically assign a hotspot in Opera

I can do it in IE7, Mozilla, Firefoz. NS8 simply by creating another map with new co-ordinates and then assigning to the new map name to the imgMap attribute.

Opera does nothing, not even an error messageJust get a reference to the area element, and inject it with a new co-ordinate string:

<BODY>
<img src='mypic.jpg' usemap='#m1' >

<MAP name='m1'>
<AREA id='area1' coords='0,0,50,50' href='#'>
</MAP>
<BR>
<A HREF='#' onclick='changeMapArea("area1","50,50,100,100")'>Change to 50,50,100,100</A><BR><BR>
<A HREF='#' onclick='changeMapArea("area1","100,100,150,150")'>Change to 100,100,150,150</A><BR><BR>

<SCRIPT type='text/javascript'>

function changeMapArea(areaId, newCoords)
{
if(document.getElementById)
document.getElementById(areaId).coords=newCoords;
else
if(document.all)
document.all(areaId).coords=newCoords;
}

</SCRIPT>
</BODY>

Kor
01-07-2007, 11:13 AM
How do you dynamically assign a hotspot in Opera

I can do it in IE7, Mozilla, Firefoz. NS8 simply by creating another map with new co-ordinates and then assigning to the new map name to the imgMap attribute.

Opera does nothing, not even an error message
In fact it works, but it works only first time when the function is fired, which is weird
http://www.codingforums.com/showthread.php?p=520823#post520823
Could be a bug... has anyone any idea?

Mr J
01-07-2007, 01:55 PM
I will follow the thread(s) and see what turns up.

There does not appear to be any problems using the DOM method to set new coords and append new area tags

Arty Effem
01-07-2007, 05:38 PM
In fact it works, but it works only first time when the function is fired, which is weird
http://www.codingforums.com/showthread.php?p=520823#post520823
Could be a bug... has anyone any idea?That code works in Opera 8.54, under which there's no need to use removeAttribute/setAttribute.
obj.useMap=v;is all that's required, same for I.E. and Moz.
I think it's clear that problem arises with Opera 9.x , which has been broken in so many other ways.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum