Javascript Image Help

Soldato
Joined
24 Mar 2006
Posts
9,089
Im using you knowledgeable people as my last resort. I feel i have tried everything...

I'm going to make this as simple as possible.

Basically I want an image to appear when I pass my cursor over a link. I want this image to replace a default image, and when my cursor is no longer on the link I want it to revert back to the default image.

Hopefully this image will help to explain.

imagecopycz2.jpg


The screenshot shows 4 state names and a map. When the state name is passed over I want the map to change so that the crosshair resembles the state the cursor is over. When the cursor is moved off the link, I want it to revert back to the default blank map.

I have messed around with some javascript and cant get it to quite work.

In <head></head>...

Code:
<script language="JavaScript">
<!--
// PRELOADING IMAGES
if (document.images) {
 img_on =new Image();  img_on.src ="images/arizona.gif"; 
 img_off=new Image();  img_off.src="images/usa.gif"; 
}

function handleOver() { 
 if (document.images) document.imgName.src=img_on.src;
}

function handleOut() {
 if (document.images) document.imgName.src=img_off.src;
}

//-->
</script>


In <body></body>...

Code:
<A href="http://www.nps.gov/buff/index.htm" onMouseOver="handleOver();return true;" onMouseOut="handleOut();return true;">
<img name=imgName width=243 height=203 border=0 alt="images\arizona.gif" src="images\usa.gif"><br>Buffalo River Trail - Arizona</a>    
<A href="http://www.nps.gov/buff/index.htm"><br>Alaska</a>  <br> 
<A href="http://www.fs.fed.us/r9/forests/shawnee/">Shawnee National Forest - Illinois</A><br>
<A href="http://www.redrivergorge.com/">Red River Gorge - Kentucky</A><br>

Many thanks to anyone who can help!
 
Back
Top Bottom