Javascript examples for DOM HTML Element:Input Button
Count button clicked times
<html> <head> <title>Space Clicker</title> </head> <body> <script type="text/javascript"> var clicks = 0;/*w w w . j av a2 s .c o m*/ function incrementClick() { clicks += 1; document.getElementById("clicks").innerHTML = clicks; }; </script> <button type="button" onclick="incrementClick()">Click me</button> <p> Clicks: <a id="clicks">0</a> </p> </body> </html>