im trying to move 3 cars across the screen
i already got it to move
but my problem is to get it to restart from the position where it started when it reaches the end of the window
no matter what size window you got
can you assist me with that please
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>DRIVING CARS</title>
<style type="text/css">
img {position:absolute;}
</style>
<script type="text/javascript">
var rgt = 50;
var rgt2 = 50;
var rgt3 = 50;
function driveCar() {
document.getElementById("car").style.top = "200px";
document.getElementById("car").style.right = rgt + "px";
document.getElementById("car2").style.top = "350px";
document.getElementById("car2").style.right = rgt2 + "px";
document.getElementById("car3").style.top = "550px";
document.getElementById("car3").style.right = rgt3 + "px";
rgt += 5;
rgt2 += 10;
rgt3 += 15;
setTimeout("driveCar()", 100);
}
</script>
</head>
<body bgcolor="pink" onload="driveCar()">
<img id="car" src="images/a.gif" /> <br /> <br /> <br />
<img id="car2" src="images/b.gif" /> <br /> <br /> <br />
<img id="car3" src="images/c.gif" />
</body>
</html>