Posted By

onblur on 04/19/11


Tagged

object event cross-browser


Versions (?)

Cross-browser javascript event capture


 / Published in: JavaScript
 

  1. function mouseDown(nsEvent) {
  2. // Support Mozilla browsers that use event passing to functions
  3. var theEvent = nsEvent ? nsEvent : window.event;
  4. var locString = "Screen X = " + theEvent.screenX + " Client X = " + theEvent.clientX + "\n";
  5. locString += "Screen Y = " + theEvent.screenY + " Client Y = " + theEvent.clientY + "\n";
  6. if ( theEvent.altKey ) {
  7. locString += " - Alt key pressed";
  8. }
  9. console.log(locString);
  10. }

Report this snippet  

You need to login to post a comment.