Ano-Tech Computers
Enter keyword:

SVG event handlers, how to pass the event object?
Problem:
When calling an event handler such as onmouse or onmouseover, how do I pass the event object containing the mouse coordinates etc?
 
Solution:
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
}

 
Discuss this solution
Did this article solve your problem? Yes No Did not apply

We welcome anyone who is willing to contribute to this public knowledge base, contact siteadmin@atc.no if you have information you would like to share. The idea is not to replace the commercial support sites, but to publish those hard-to-find solutions you've found yourself looking for over and over again.

Show all articles