Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.onmousedown = function(){document.onmousemove = getMouseX;}; //invocation
- function getMouseX(e)
- {
- var IE = document.all?true:false
- if (!IE)
- document.captureEvents(Event.MOUSEMOVE);
- var tempX = 0;
- if (IE) // grab the x-y pos.s if browser is IE
- tempX = event.clientX + document.body.scrollLeft;
- else // grab the x-y pos.s if browser is NS
- tempX = e.pageX;
- // catch possible negative values in NS4
- if (tempX < 0)
- tempX = 0;
- // show the position values in the form named Show
- // in the text fields named MouseX and MouseY
- dbgField.value = tempX;
- tmpLayer.style.left = tempX;
- }
Add Comment
Please, Sign In to add comment