Hi If could please take a look at my code and tell me what the next step I am looking for to get this result.
<script type="text/javascript">
function doMove1() {
foo1.style.left = parseInt(foo1.style.left)+1+'px';
setTimeout(doMove1,20); // call doMove in 20msec
}
function start1() {
foo1 = document.getElementById('fooObject'); // get the "foo" object
foo1.style.left = '0px'; // set its initial position to 0px
doMove1(); // start animating
}
window.onload = start1;
</script>
<body>
<div id="fooObject">
<img src="images/pac.gif" width="38" height="38"></div>
</body>
Basically what happens is that a image moves across the screen.What i am trying to accomplish is that when the image gets to a certain px (Lets say 900px) I want an event to fire. Any tips on accomplishing this task I am a beginner Ive been working on this all day before i thought to seek help.
Just add a check for this in
doMove1:Does that help?