Advertisement
Guest User

Untitled

a guest
May 30th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JS Bin</title>
  6. <style id="jsbin-css">
  7. .myButton {
  8.  
  9.  
  10. }
  11. </style>
  12. </head>
  13. <body>
  14. <button class='myButton' onclick="countClicks()">Click ME!</button>
  15. <p id='teacherClickCount'>Teacher Count</p>
  16. <!--(1) Have the paragraph 'Student Count' show the number of clicks"-->
  17. <p id='studentClickCount'>Student Count</p>
  18. <p id='randomClickCount'>Random</p>
  19. <!-- (2) Add a conditional so that a cow GIF shows up here at the bottom of the page when the user hits 50 clicks.-->
  20. <img id='cow'>
  21. <script id="jsbin-javascript">
  22. var clicks=0;
  23. function countClicks() {
  24. clicks++;
  25. // (1) Delete the alert function and make the 'Student Count' pargraph the number of clicks instead. Hint:'get the element by its ID and change the inner text to the number of clicks'
  26. document.getElementById('studentClickCount').innerHTML=clicks;
  27. // (2) Add a conditional so that a cow GIF shows up at the bottom of the page when the user hits 50 clicks. Hint: If the number of clicks equals 50 set the image attribute to a cow GIF.
  28. }
  29. </script>
  30.  
  31.  
  32. <script id="jsbin-source-css" type="text/css">
  33. .myButton {
  34.  
  35.  
  36. }</script>
  37.  
  38. <script id="jsbin-source-javascript" type="text/javascript">var clicks=0;
  39. function countClicks() {
  40. clicks++;
  41. // (1) Delete the alert function and make the 'Student Count' pargraph the number of clicks instead. Hint:'get the element by its ID and change the inner text to the number of clicks'
  42. document.getElementById('studentClickCount').innerHTML=clicks;
  43. // (2) Add a conditional so that a cow GIF shows up at the bottom of the page when the user hits 50 clicks. Hint: If the number of clicks equals 50 set the image attribute to a cow GIF.
  44. }
  45.  
  46.  
  47.  
  48.  
  49. </script></body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement