Mega Code Archive

 
Categories / JavaScript Tutorial / Style
 

Animation by changing the pixelLeft (IE)

< html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- function moveTxt() {     if (document.all) {         if (ani1.style.pixelLeft < 500)         {             ani1.style.pixelLeft += 2;             setTimeout("moveTxt()", 50);         }     } else if (document.ani1.left < 500) {         document.ani1.left += 2;         setTimeout("moveTxt()", 50);     } } //  --> </script> </head> <body onLoad="moveTxt()"> <div id="ani1" style="position:absolute;left:10;top:10"> Text ... on the go! </div> </body> </html>