rent27
Apr 30th 2009, 1:30 pm
hi. i'm really new to javascript, so i don't know what i'm doing yet. i'm trying to use the z-index to bring an image in front of another on a mouseOver, and for that image to return to the back on mouseOut.
here's what i'm doing:
<head>
<script type="text/javascript">
function switchZ()
{
var Z=document.getElementById("europemap").style.zIndex;
document.getElementById("europemap").style.zIndex="0";
var Y=document.getElementById("other").style.zIndex;
document.getElementById("europemap").style.zIndex=Y;
document.getElementById("other").style.zIndex=Z;
}
</script>
</head>
<body>
<div id="container" class="clearfix">
<div id="content">
<div id="plainmap">
<img id="europemap" src="europemap.jpg" onMouseOver="switchZ()"/>
</div>
<div id="selmap">
<img id="other" src="countries.png" usemap="#europe" onMouseOut="switchZ()"/>
</div>
...
</body>
i was trying to just swap the z-indexes of the two images in the switchZ() function, but i've obviously done something wrong somewhere in here. what can i do to fix it?
thanks.
here's what i'm doing:
<head>
<script type="text/javascript">
function switchZ()
{
var Z=document.getElementById("europemap").style.zIndex;
document.getElementById("europemap").style.zIndex="0";
var Y=document.getElementById("other").style.zIndex;
document.getElementById("europemap").style.zIndex=Y;
document.getElementById("other").style.zIndex=Z;
}
</script>
</head>
<body>
<div id="container" class="clearfix">
<div id="content">
<div id="plainmap">
<img id="europemap" src="europemap.jpg" onMouseOver="switchZ()"/>
</div>
<div id="selmap">
<img id="other" src="countries.png" usemap="#europe" onMouseOut="switchZ()"/>
</div>
...
</body>
i was trying to just swap the z-indexes of the two images in the switchZ() function, but i've obviously done something wrong somewhere in here. what can i do to fix it?
thanks.