Posted By

szsk on 08/02/06


Tagged

javascript event DOM mouse


Versions (?)

Who likes this?

27 people have marked this snippet as a favorite

luman
meth
hides
hxseven
noah
fael
vali29
Winkyboy
yetanother
SpinZ
kcmr
wizard04
hans
rubensarrio
donesmart
oldmeaty
RagnarR
ckayra
davidsi
masondixon
jaff
omerta83
bobbym245
seanpowell
claudiowebdesign
tspitzr
jondiscipulo


getMousePosition


 / Published in: JavaScript
 

  1. function getMouseX( e ) {
  2. return e.pageX
  3. || ( e.clientX + ( document.documentElement.scrollLeft
  4. || document.body.scrollLeft ) );
  5. }
  6. function getMouseY( e ) {
  7. return e.pageY
  8. || ( e.clientY + ( document.documentElement.scrollTop
  9. || document.body.scrollTop ) );
  10. }

Report this snippet  

You need to login to post a comment.