<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>
Html
Started by
Harut
, Jul 11 2003 05:48 PM
3 replies to this topic
#1
Posted 11 July 2003 - 05:48 PM
why doesn't changing the 'offset' make any difference?
#2
Posted 11 July 2003 - 06:15 PM
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.
! 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.
#3
Posted 11 July 2003 - 07:16 PM
ay ay ay
thanks
offset=-offset
thanks
offset=-offset
#4
Posted 11 July 2003 - 07:19 PM
btw, the drag feature is pretty cool
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users