Javascript examples for DOM Event:onclick
Pass event object to onclick event handler
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . ja v a2s . co m*/ window.testing = function(event){ console.log('testing'); console.log(event); console.log(this)//will the element which called the handler } } </script> </head> <body> <img src="http://www.java2s.com/style/download.png" onclick="testing(event)"> click here </body> </html>