Revision: 5936
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 14, 2008 10:32 by micmath
Initial Code
function handleEvent(e) { if (!e) var e = window.event; var posx = 0; var posy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX + document.body.scrollLeft; posy = e.clientY + document.body.scrollTop; } // posx and posy contain // the mouse position relative to the document // Do something with this information }
Initial URL
http://evolt.org/article/Mission_Impossible_mouse_position/17/23335/index.html
Initial Description
Snagged from pp]{ It's relative to document, not the visible area in the window.
Initial Title
Get mouse coordinates relative to document
Initial Tags
Initial Language
JavaScript