Javascript examples for DOM:Event
Apply "use strict" in event handler
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// www . jav a 2 s . c o m document.getElementById("p1").addEventListener("click", function(){ "use strict"; console.log("P1 BUTTON CLICKED!!!"); }); } </script> </head> <body> <button id="p1">Player 1</button> <button id="p2">Player 2</button> <button id="reset">Reset</button> </body> </html>