Hi,
Whats wrong with the following code..I can not move the object(textbox)
will you help me fix it?
VB Code:
<html> <head> <script> var delay=100; //delay time in milliseconds var left=0; //Initial X position var right=window.width/2; // Final X position var top=window.height/2; //Initial Y position var bottom=windows.height; //Final Y position var Xstep=windows.width/60; //X moving step var Ystep=windows.height/10; //Y moving step function MovingObject(ObjectToMove) { ObjectToMove.scrLeft=left; ObjectToMove.scrTop=top; setTimeOut(delay,"Moving(ObjectToMove)"); } function Moving(ObjectToMove) { if(ObjectToMove.scrLeft<=right) { ObjectToMove.srcLeft=ObjectToMove.srcLeft + Xstep; setTimeOut(delay,"Moving(ObjectToMove)"); } else { if(ObjectToMove.scrTop<=bottom) { ObjectToMove.scrTop=ObjectToMove.scrTop+Ystep; setTimeOut(delay,"Moving(ObjectToMove)"); } } } document.keydown=MovingObject(xyz); //xyz is the object you wanna move </script> </head> <body onload="MovingObject()"> <form> <input type=text id="xyz"> </form> </body> </html>




Reply With Quote