0

First take two images named with smirk1.jpg and smirk2.jpg with same size
paste below code and for Image write this code

<IMG src="smirk1.jpg" name="smirk" onMouseOver="over(0);" onMouseOut="out(0);" />

<script type="text/javascript">
var revert = new Array();
var inames = new Array('smirk');

// Preload
if (document.images) {
  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = ""+inames[i]+"2.JPG";
  }
}
 
function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}
function out(num) {
  if(docu <script type="text/javascript">
var revert = new Array();
var inames = new Array('smirk');
 
// Preload
if (document.images) {
  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = ""+inames[i]+"2.JPG";
  }
}
 
function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}
function out(num) {
  if(document.images) document.images[inames[num]].src = revert[num];
}
</script>
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by ayesha789
0

I design 2 pictures as shirk1.jpg and shirk2.jpg and
in body I use Image Tag and in Head I put script.
But it only shows image1 that is shirk1.jpg

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.