Guest User

Untitled

a guest
May 21st, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. document.onmousedown = function(){document.onmousemove = getMouseX;}; //invocation
  2.  
  3. function getMouseX(e)
  4. {
  5. var IE = document.all?true:false
  6. if (!IE)
  7. document.captureEvents(Event.MOUSEMOVE);
  8. var tempX = 0;
  9. if (IE) // grab the x-y pos.s if browser is IE
  10. tempX = event.clientX + document.body.scrollLeft;
  11. else // grab the x-y pos.s if browser is NS
  12. tempX = e.pageX;
  13. // catch possible negative values in NS4
  14. if (tempX < 0)
  15. tempX = 0;
  16. // show the position values in the form named Show
  17. // in the text fields named MouseX and MouseY
  18. dbgField.value = tempX;
  19. tmpLayer.style.left = tempX;
  20. }
Add Comment
Please, Sign In to add comment