Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Clicker Game </title>
  5. <style>
  6.  
  7. body {
  8. background: gray;
  9. }
  10.  
  11. button {
  12. background: yellow;
  13. width: 50px;
  14. height: 50px;
  15. }
  16.  
  17. </style>
  18. </head>
  19. <body>
  20. <button onClick="pl()">Clicker</button><br />
  21. <h1 id="p"></h1>
  22. <script>
  23. //Defineing numbers
  24. var add = 1;
  25. var num = 0;
  26. var ans = document.getElementById("p").innerHTML = num;
  27.  
  28. //adding the display number with the ammount the user clicks
  29. function pl() {
  30. num += add;
  31. var ans = document.getElemntById("p").innerHTML = num;
  32. }
  33.  
  34. //You can have some fun with this :-)
  35. /*if (add >= 10) {
  36. add = 2;
  37. } else if (add >= 50) {
  38. add = 5;
  39. }*/
  40.  
  41. }
  42.  
  43. </script>
  44. </body>
  45. </html>
Add Comment
Please, Sign In to add comment