Skrevet av Emne: SVG event handlers, how to pass the event object?  (Lest 5277 ganger)

ATC

  • Gjest
SVG event handlers, how to pass the event object?
« på: 18. Juli 2010, 17:52 pm »
  • [applaud]0
  • [smite]0
  • When calling an event handler such as onmouse or onmouseover, how do I pass the event object containing the mouse coordinates etc?



    ATC

    • Gjest
    [Solved] SVG event handlers, how to pass the event object?
    « Svar #1 på: 18. Juli 2010, 17:52 pm »
  • [applaud]0
  • [smite]0
  • The reserved name 'evt' contains the mouse event. Example:
    onclick="call_handler(evt);"

    In the corresponding javascript, use:
    function callhandler(event) {
      object = event.target; // object now contains the element
    }