Javascript examples for DOM Event:onclick
Handle both left and right click event (onclick) action
<html> <head> <script type="text/javascript"> function handleRightClick() { console.log("Got right click!"); };/* w ww . j a va 2 s. com*/ function handleLeftClick() { console.log("Got left click!"); }; </script> </head> <body> <img src="http://www.java2s.com/style/download.png" onclick="handleLeftClick(this);" oncontextmenu="handleRightClick(this); return false;"> </body> </html>