Image Change On Mouseover and Mouseout

[Total: 0    Average: 0/5]

This shows how to have an image that has a roll over effect.

Body Code:

<script type=text/javascript>
_i0 = new Image(); _i0.src = "http://www.js-examples.com/js/pic1.gif";
_i1 = new Image(); _i1.src = "http://www.js-examples.com/js/pic2.gif";

function doOn(_i,_n) {
  eval("document[""+_i+""].src="+_n+"1.src");
}
function doOut(_i,_n) {
  eval("document[""+_i+""].src="+_n+"0.src");
}
</script> 

<a href="#" onmouseover="doOn('myimg','_i')" onmouseout="doOut('myimg','_i')">
<img name="myimg" src="http://www.js-examples.com/js/pic1.gif">
</a>

Times Viewed: 2

Leave a Reply

Your email address will not be published. Required fields are marked *