Javascript examples for DOM Event:onclick
Get attribute value from onClick event handler
<html> <head> <title>Page Title</title> </head> <body> <img id="like1" src="http://www.java2s.com/style/download.png" style="width:23px;height:23px;" title="???" value="1" onclick="onClick(this)"> asdf// w w w . ja va 2 s. c o m <img id="hate1" src="http://www.java2s.com/style/download.png" style="width:23px;height:23px;" onclick="onClick(this)" value="-1" title="asdf"> asdf <script> function onClick(int) { console.log(int.getAttribute('value')); console.log(int.getAttribute('value')); } </script> </body> </html>