Two Images Doing Mouseovers

[Total: 0    Average: 0/5]

This shows how to have 2 images alternate their pictures on a mouseover.

Head Code:

<script type=text/javascript>
function do1() {
  document.p1.src="http://www.js-examples.com/js/pic2.gif";
  document.p2.src="http://www.js-examples.com/js/pic1.gif";
}
function do2() {
  document.p1.src="http://www.js-examples.com/js/pic1.gif";
  document.p2.src="http://www.js-examples.com/js/pic2.gif";
}
</script>

Body Code:

<div onmouseover="do1()" style="clip:rect(0,50,50,0);width:50;height:50;">
<img src="http://www.js-examples.com/js/pic1.gif" width=50 height=50 name=p1>
</div>
<BR><BR>
<div onmouseover="do2()" style="clip:rect(0,50,50,0);width:50;height:50;">
<img src="http://www.js-examples.com/js/pic2.gif" width=50 height=50 name=p2>
</div>

Times Viewed: 0

Leave a Reply

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