Image Links 2

See also Multi Image Links 2

The image is changed on mouseover, mouseout, mousedown, and mouseup.
The onmouseup image remains until you mouseup on another image.
The same image is used for the relevant event.


<script type="text/javascript">
<!--
var images = ["1.gif","2.gif","3.gif","4.gif"] // list images to preload

var preloadImages=new Array() // preloads images
for (i=0;i<images.length;i++) {
preloadImages[i]=new Image()
preloadImages[i].src=images[i]
}

lastN = ""

function mOver(n){
if(lastN != n){
document.images[n].src = images[1]
}
}

function mOut(n){
if(lastN != n){
document.images[n].src = images[0]
}
}

function mDown(n){
if(lastN != n){
document.images[n].src = images[2]
}
}

function mUp(n){
document.images[n].src = images[3]
if (lastN != "" && lastN != n){
document.images[lastN].src = images[0]
}
lastN = n
}
// -->
</script>

<h1>Image Links 2</h1>

<P>
The image is changed on mouseover, mouseout, mousedown, and mouseup.<br>
The onmouseup image remains until you mouseup on another image.<br>
The same image is used for the relevant event.

<P>
<a href="#null"><img src="1.gif" name="img1" alt="" onmouseover="mOver('img1');" onmouseout="mOut('img1')" onmousedown="mDown('img1')" onmouseup="mUp('img1')"></a>
<a href="#null"><img src="1.gif" name="img2" alt="" onmouseover="mOver('img2');" onmouseout="mOut('img2')" onmousedown="mDown('img2')" onmouseup="mUp('img2')"></a>
<a href="#null"><img src="1.gif" name="img3" alt="" onmouseover="mOver('img3');" onmouseout="mOut('img3')" onmousedown="mDown('img3')" onmouseup="mUp('img3')"></a>
<a href="#null"><img src="1.gif" name="img4" alt="" onmouseover="mOver('img4');" onmouseout="mOut('img4')" onmousedown="mDown('img4')" onmouseup="mUp('img4')"></a>