BrotherArnold
Technical User
Hi,
I'm sure this is simple but not being familiar with JavaScript and looking over other threads and trying things out hasn't got me as far as I would have liked so it's time to short cut and ask for help.
The code below works fine for swapping images on mouseover and mouseout. What I want to do now is add additional functionality to change the image in 'map' to bg_img3 when I mouseover the Home text and back to bg_img2 when I mouseout.
So the last div statement is wrong and I guess I might need another function like swapImage but everything I try places bg_img3 below the 'map' div when I want it to appear within it like the other images. Any help gratefully received.
Brother Arnold
"keep passing the open windows..."
I'm sure this is simple but not being familiar with JavaScript and looking over other threads and trying things out hasn't got me as far as I would have liked so it's time to short cut and ask for help.
The code below works fine for swapping images on mouseover and mouseout. What I want to do now is add additional functionality to change the image in 'map' to bg_img3 when I mouseover the Home text and back to bg_img2 when I mouseout.
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function swapImage(imgObj, hovered_over)
{
if (imgObj.id == 'graphic')
{
if (hovered_over)
{
imgObj.src = 'Images/bg_img1.jpg';
}
else
{
imgObj.src = 'Images/bg_img2.jpg';
}
}
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<div id="map">
<IMG SRC="Images\bg_img2.jpg" onMouseOver="swapImage(this, true);" onMouseOut="swapImage(this, false);" id="graphic">
</div>
<div id="home" onMouseOver="swapImage('home', true);" onMouseOut="swapImage('home', false);">Home</div>
</BODY>
</HTML>
So the last div statement is wrong and I guess I might need another function like swapImage but everything I try places bg_img3 below the 'map' div when I want it to appear within it like the other images. Any help gratefully received.
Brother Arnold
"keep passing the open windows..."