Image Animation
<html> <head> <script language="JavaScript"> <!-- var alternate = 0; var timerId; var images = new Array("yb.gif", "rb.gif"); // Image URLs function startAnimation() { alternate = (alternate == 0) ? 1 : 0; // Alternate images document.images[0].src = images[alternate]; // Update image timerId = setTimeout("startAnimation()", 1000); // 1 second update } //--> </script> </head> <body> <img border=0 hspace=5 width=10 src="http://www.java2s.com/style/logo.png">Hover over <a href="#" onMouseOver="startAnimation()" onMouseOut="clearTimeout(timerId)"> this</a> link to start the animation.<p> </body> </html>