Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javscript">
- var count = 0;
- function listeners() {
- document.getElementById("element").addEventListener("click","listenerAction",false);
- }
- function listenerAction() {
- count++;
- if(count == 1) {
- var text = "You clicked the button for the first time!";
- } else {
- var text = "You clicked the button" + count + "times!";
- }
- alert(text);
- }
- window.onload = listeners();
- </script>
- </head>
- <body>
- <input type="button" id="element" value="Click me!" />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement