Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Clicker Game </title>
- <style>
- body {
- background: gray;
- }
- button {
- background: yellow;
- width: 50px;
- height: 50px;
- }
- </style>
- </head>
- <body>
- <button onClick="pl()">Clicker</button><br />
- <h1 id="p"></h1>
- <script>
- //Defineing numbers
- var add = 1;
- var num = 0;
- var ans = document.getElementById("p").innerHTML = num;
- //adding the display number with the ammount the user clicks
- function pl() {
- num += add;
- var ans = document.getElemntById("p").innerHTML = num;
- }
- //You can have some fun with this :-)
- /*if (add >= 10) {
- add = 2;
- } else if (add >= 50) {
- add = 5;
- }*/
- }
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment