Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. </head>
  6. <body>
  7. <header>
  8. My Calculator
  9. <h1></h1>
  10. </header>
  11. <section>
  12. <article>
  13. <form name="calculate">
  14.  
  15. <p id="output"></p>
  16.  
  17. <br/>
  18. <button style="height:40px;width:40px" id="clrBtn">C</button>
  19. <button style="height:40px;width:40px" id="delBtn">del</button>
  20. <button style="height:40px;width:40px" id="perBtn">%</button>
  21. <button style="height:40px;width:40px" id="divBtn">/</button>
  22. <br/>
  23. <button style="height:40px;width:40px">7</button>
  24. <button style="height:40px;width:40px">8</button>
  25. <button style="height:40px;width:40px">9</button>
  26. <button style="height:40px;width:40px" id="mulBtn">X</button>
  27. <br/>
  28. <button style="height:40px;width:40px">4</button>
  29. <button style="height:40px;width:40px">5</button>
  30. <button style="height:40px;width:40px">6</button>
  31. <button style="height:40px;width:40px" id="subBtn">-</button>
  32. <br/>
  33. <button style="height:40px;width:40px">1</button>
  34. <button style="height:40px;width:40px">2</button>
  35. <button style="height:40px;width:40px">3</button>
  36. <button style="height:40px;width:40px" id="addBtn">+</button>
  37. <br/>
  38. <button style="height:40px;width:84px">0</button>
  39. <button style="height:40px;width:40px" id="decBtn">.</button>
  40. <button style="height:40px;width:40px" id="eqlBtn">=</button>
  41.  
  42.  
  43.  
  44.  
  45.  
  46. <script type ="text/javascript">
  47.  
  48. var myNum = 0;
  49.  
  50. document.getElementById("output").innerHTML = myNum;
  51. document.getElementById("clrBtn").onclick = function() {buttonClick()};
  52.  
  53. function buttonClick() {
  54. myNum = document.getElementById("clrBtn").innerHTML
  55. document.getElementById("output").innerHTML = myNum;
  56. console.log(myNum);
  57. }
  58.  
  59. </script>
  60. </article>
  61. </section>
  62. <footer>
  63.  
  64. </footer>
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement