Thursday, May 8, 2008

Animation using javascript

Define tml tags and script tags
"TIGER" means image box id.

var TigerTimer;
function AnimateTiger()
{
clearInterval(TigerTimer);
document.getElementById("TIGER").style.left = "600px";
TigerTimer = setInterval("MoveTiger()", 20);
}
function MoveTiger()
{
document.getElementById("TIGER").style.pixelLeft -= 2;
if (document.getElementById("TIGER").style.pixelLeft <= 0) {
document.getElementById("TIGER").style.left = "600px";

}
}

1 comment:

Anonymous said...

ITs very nice to share