Hi,
Whats wrong with the following code..I can not move the object(textbox)
will you help me fix it?
VB Code:
  1. <html>
  2. <head>
  3. <script>
  4. var delay=100; //delay time in milliseconds
  5. var left=0; //Initial X position
  6. var right=window.width/2; // Final X position
  7. var top=window.height/2; //Initial Y position
  8. var bottom=windows.height; //Final Y position
  9. var Xstep=windows.width/60; //X moving step
  10. var Ystep=windows.height/10; //Y moving step
  11. function MovingObject(ObjectToMove) {
  12.     ObjectToMove.scrLeft=left;
  13.     ObjectToMove.scrTop=top;
  14.     setTimeOut(delay,"Moving(ObjectToMove)");
  15. }
  16. function Moving(ObjectToMove) {
  17.     if(ObjectToMove.scrLeft<=right) {
  18.         ObjectToMove.srcLeft=ObjectToMove.srcLeft + Xstep;
  19.         setTimeOut(delay,"Moving(ObjectToMove)");
  20.     } else {
  21.         if(ObjectToMove.scrTop<=bottom) {
  22.             ObjectToMove.scrTop=ObjectToMove.scrTop+Ystep;
  23.             setTimeOut(delay,"Moving(ObjectToMove)");
  24.         }
  25.     }
  26. }
  27. document.keydown=MovingObject(xyz); //xyz is the object you wanna move
  28. </script>
  29. </head>
  30. <body onload="MovingObject()">
  31. <form>
  32. <input type=text id="xyz">
  33. </form>
  34. </body>
  35. </html>