tintinfreak
01-07-2006, 02:33 PM
I tried to create an animation but it didn't work!
Here is the code:
***
<html>
<head>
<script language="javascript">
one=new Image()
one.src="1.gif"
two=new Image()
two.src="2.gif"
three=new Image()
three.src="3.gif"
pic= new Array()
pic[0]=one.src
pic[1]=two.src
pic[2]=three.src
var a=0
var x
function animation()
{
clearTimeout(x)
document['tmuna'].src=pic[a]
a++
if(a>2)
a=0
x=setTimeout('animation()',1000)
}
</script>
</head>
<body onload="animation()">
<img name="tmuna" src="1.gif">
</body>
</html>
***
tintinfreak
Here is the code:
***
<html>
<head>
<script language="javascript">
one=new Image()
one.src="1.gif"
two=new Image()
two.src="2.gif"
three=new Image()
three.src="3.gif"
pic= new Array()
pic[0]=one.src
pic[1]=two.src
pic[2]=three.src
var a=0
var x
function animation()
{
clearTimeout(x)
document['tmuna'].src=pic[a]
a++
if(a>2)
a=0
x=setTimeout('animation()',1000)
}
</script>
</head>
<body onload="animation()">
<img name="tmuna" src="1.gif">
</body>
</html>
***
tintinfreak