Twango Posted January 9, 2010 Share Posted January 9, 2010 Hey, i was making a 'fall' script.here's what i got.<html><head><style type="text/css">p.movve {position:fixed;top:0px}</style><script type="text/javascript">function move(){document.getElementById('movve').style.top="100px";}</script></head></html><p id="movve" onclick="move()">FALL!!</p>and i want it to move across the screen but it's not. please help Link to comment Share on other sites More sharing options...
Ingolme Posted January 9, 2010 Share Posted January 9, 2010 Your move() function doesn't move the element, it just puts it at exactly 100px from the top of the screen, which is exactly what you're telling it to do. Link to comment Share on other sites More sharing options...
thescientist Posted January 9, 2010 Share Posted January 9, 2010 you would probably want it to maybe loop such that it increments a variable by say 10 px at a time, and then add that the current amount of pixels moved so far and then set your javascript function to move it after each addition. So on and so forth until it gets to the end of where you want it to end up. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.