Mega Code Archive

 
Categories / JavaScript DHTML / HTML
 

An animating image

/* Javascript Essentials by Jason J. Manger Publisher: Mcgraw-Hill Osborne Media;  ISBN: 0078822343 */ <!--   Program 4-6   Author note:   There have been problems with Netscape's images[] array. The   image may not animate within a frameset document. --> <html> <head> <script language="JavaScript"> <!--   var alternate = 0;   function animIcon() {     if (parent.alternate == 0) {        document.images[0].src = "rb.gif";        alternate = 1;     }     else {        document.images[0].src = "yb.gif";        alternate = 0;     }     setTimeout("animIcon()", 1000);   } //--> </script> </head> <body onLoad="parent.animIcon()"> <img src="yb.gif" hspace=4>This is an animating image. </body> </html>