Advertisement
tei123

calc

Sep 30th, 2016
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <html lang="pl">
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <script>
  6. var s,a;
  7. s=0;
  8. function licz()
  9. {
  10. a=parseFloat(document.getElementById("pole").value);
  11. s=s+a;
  12. document.getElementById("wyniko").value=s;
  13. }
  14. function czysc()
  15. {
  16. document.getElementById("wyniko").value="";
  17. document.getElementById("pole").value="";
  18. s=0;
  19. }
  20. function a9()
  21. {
  22. document.getElementById("wyniko").value="9";
  23. }
  24. function a8()
  25. {
  26. document.getElementById("wyniko").value="8";
  27.  
  28. }
  29. function a7()
  30. {
  31. document.getElementById("wyniko").value="7";
  32. }
  33. function a6()
  34. {
  35. document.getElementById("wyniko").value="6";
  36. }
  37. function a5()
  38. {
  39. document.getElementById("wyniko").value="5";
  40. }
  41. function a4()
  42. {
  43. document.getElementById("wyniko").value="4";
  44. }
  45. function a3()
  46. {
  47. document.getElementById("wyniko").value="3";
  48. }
  49. function a2()
  50. {
  51. document.getElementById("wyniko").value="2";
  52. }
  53. function a1()
  54. {
  55. document.getElementById("wyniko").value="1";
  56. }
  57. function a0()
  58. {
  59. document.getElementById("wyniko").value="";
  60. }
  61. </script>
  62. </head>
  63. <body>
  64. <center>
  65. <button onClick="licz()">Widok</button>
  66. <button onClick="licz()">Edycja</button>
  67. <button onClick="licz()">Pomoc</button>
  68. <br>
  69. <input type="text" id="wyniko"/>
  70. <br>
  71.  
  72. <button onClick="a9()">9</button>
  73. <button onClick="a8()">8</button>
  74. <button onClick="a7()">7</button>
  75. <br>
  76. <button onClick="a6()">6</button>
  77. <button onClick="a5()">5</button>
  78. <button onClick="a4()">4</button>
  79. <br>
  80. <button onClick="a3()">3</button>
  81. <button onClick="a2()">2</button>
  82. <button onClick="a1()">1</button>
  83. <br>
  84. <button onClick="a0()">0</button>
  85. <button onClick="licz()">=</button>
  86. <button onClick="czysc()">C</button>
  87. </body>
  88. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement