[Javascript] Event Capture

Filipiak, Bob (Contractor) filipiab at atsc.army.mil
Fri Mar 23 07:37:38 CST 2001


One of the best investments I've made, IMHO, is "Pure JavaScript" by Wyke,
Gilliam, and Ting ISBN:0-672-31547-5 if for nothing else the Appendices that
show the functions supported by various versions of Netscape, Internet
Explorer, Opera, and ECMAScript support.

-----Original Message-----
From: Steve White [mailto:steve at VirtualMechanics.com]
Sent: Thursday, March 22, 2001 9:11 AM
To: javascript at LaTech.edu
Subject: [Javascript] Event Capture


Similar problem to my other posts. I need to capture events for different
Browsers. To capture a mouse move for example, can I use this method for all
3 Browser formats? How do I capture the scroll position for NN6/IE5 ?

<BODY onmousemove="mouseMove(evt)">
...
</BODY>

<SCRIPT>
function mouseMove(evt) { // NN6, IE5, Opera 5
  if(document.getElementById) {
    cmx = evt.getClientX();
    cmy = evt.getClientY();
  }
  else if(document.all) { // IE4
    cmx = evt.clientX + document.body.scrollLeft;
    cmy = evt.clientY + document.body.scrollTop;
  }
  else if(document.layers) { // NN4
    cmx = evt.pageX + window.pageXOffset;
    cmy = evt.pageY + window.pageYOffset;
  }
}
</SCRIPT>

Thanks

steve at VirtualMechanics.com
www.VirtualMechanics.com
www.SVGMagic.com


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010323/7cc00367/attachment.htm>


More information about the Javascript mailing list