topical media & game development

talk show tell print

#javascript-code-16-getElementX.js / js



  // Get the X position of the mouse relative to the element target
  // used in event object ā€˜e’
  function getElementX( e ) {
      // Find the appropriate element offset
      return ( e && e.layerX ) || window.event.offsetX;
  }
   
  // Get the Y position of the mouse relative to the element target
  // used in event object ā€˜e’
  function getElementY( e ) {
      // Find the appropriate element offset
      return ( e && e.layerY ) || window.event.offsetY;
  }
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.