|
-
Feb 4th, 2005, 06:39 PM
#1
Thread Starter
Fanatic Member
style.posLeft-10 !!!
Hi,
My aim is to move the object(car1) as far as the right border(screen.availWidth-200)
and and then comes back to the starting point(x=10) .But it does not work !! I can't seeWhy this line"car1.style.posLeft-=10;"
does not work? I know that there are some working-script on the net javascript "space-invaders"
Could you help me?
<script>
aa=setInterval("move()",100)
function move()
{
var car1=document.getElementById('car1')
car1.style.posLeft+=10;
if(car1.style.posLeft>=screen.availWidth-200)
{
car1.style.posLeft==(screen.availWidth-200)
car1.style.posLeft-=10;
document.bgColor="pink";
}
}
</script>
<body>
<input type=text name=car1 size=5 value="car1" style=position:absolute;>
</body>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|