Javascript examples for DOM Event:event function
Pass element itself into action event handler
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <img id="img1" src="a.png" alt="" onclick="select(this.id)"> <img id="img2" src="a.png" alt="" onclick="select(this.id)"> <script> function select(id){ console.log(id); }//from w w w .j a v a 2s .c o m </script> </body> </html>