I'm really new at JavaScript, but I thought an image map with rollover images would be a relatively basic feat...
I have a large map with hotspots over individual states. I want the user to hover over a hotspot and for the main image to change, displaying information for that particular state. I've tried code that other developers have sworn works in all browsers, but still can't get the same functionality in FF or Chrome as I do in IE.
The last thing I tried was ...
In the head tag...
<SCRIPT language="javascript" type="text/javascript">
function swapImage(image) {
var Map = (document.getElementById) ? document.getElementById('MapWest') : (document.images) ? document.images['MapWest'] : (document.all) ? document.all['MapWest'] : null;
if(Map) Map.src = image;
}
</SCRIPT>
And in the body...
<img id="MapWest" src="images/map/MapWest_NowServing.png" alt="" name="MapWest" height="508" width="700" usemap="#MapWest_NowServing" border="0"><map name="MapWest_NowServing"><a href="javascript:void(0)" onmouseover="swapImage('images/map/MapWest_WA.png')" onmouseout="swapImage('images/map/MapWest_NowServing.png')"><area title="Washington" shape="rect" coords="73,9,160,70" href="#" alt=""></a></map>
Is anyone able to tell me what I'm doing wrong/missing?
Thank you very much in advance!