Harut Posted July 11, 2003 Report Share Posted July 11, 2003 why doesn't changing the 'offset' make any difference? <html> <head> <script language="JavaScript"> function drag() { dragMe.style.left=event.clientX; dragMe.style.top=event.clientY; } var offset=10; function rock() { offset=!offset; rockMe.style.top=200+offset; rockMe.style.left=100+offset; inter=setTimeout("rock()",100); } </script> </head> <body> <img src="dg.gif" id="dragMe" onDrag="drag()" style="position:absolute;left:100"> <input type="button" id="rockMe" value="Rock Me" onMouseOver="rock()" onMouseOut="clearTimeout(inter)" style="position:absolute;left:100;top:200"> </body> </html> Quote Link to comment Share on other sites More sharing options...
Sip Posted July 12, 2003 Report Share Posted July 12, 2003 offset=!offset ! is the logical NOT operation ... if offset is non-zero, !offset will become 0. If offset is 0, !offset should be 1 I think. So it really only depends if offset is zero or not. Quote Link to comment Share on other sites More sharing options...
Harut Posted July 12, 2003 Author Report Share Posted July 12, 2003 ay ay ay thanks offset=-offset Quote Link to comment Share on other sites More sharing options...
Harut Posted July 12, 2003 Author Report Share Posted July 12, 2003 btw, the drag feature is pretty cool Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.