MoRiA
01-19-2003, 04:38 PM
I am trying to create a script that will move an image off the side of the screen gradually (but still pretty quickly). I currently have the code:
<script>
var distance = 50;
function move() {
If (distance < "500") {
zelda.style.left = distance;
distance=distance+50;
setTimeout("move();", 100);
}
}
</script>
<center>
<img style="position: 'relative'; left: -100;" src="zelda.jpg" name="zelda" onMouseOver="move();">
</center>
For some reason whenever I run this code it stops when trying to call the move() function with an error of "object expected".
if i remove all the lines of code in the function and add them all back in individually it works up to the point where I add the setTimeout() command so I'm assuming it's a setTimeout() problem.
Thanks for your help.
<script>
var distance = 50;
function move() {
If (distance < "500") {
zelda.style.left = distance;
distance=distance+50;
setTimeout("move();", 100);
}
}
</script>
<center>
<img style="position: 'relative'; left: -100;" src="zelda.jpg" name="zelda" onMouseOver="move();">
</center>
For some reason whenever I run this code it stops when trying to call the move() function with an error of "object expected".
if i remove all the lines of code in the function and add them all back in individually it works up to the point where I add the setTimeout() command so I'm assuming it's a setTimeout() problem.
Thanks for your help.