Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <header>
- My Calculator
- <h1></h1>
- </header>
- <section>
- <article>
- <form name="calculate">
- <p id="output"></p>
- <br/>
- <button style="height:40px;width:40px" id="clrBtn">C</button>
- <button style="height:40px;width:40px" id="delBtn">del</button>
- <button style="height:40px;width:40px" id="perBtn">%</button>
- <button style="height:40px;width:40px" id="divBtn">/</button>
- <br/>
- <button style="height:40px;width:40px">7</button>
- <button style="height:40px;width:40px">8</button>
- <button style="height:40px;width:40px">9</button>
- <button style="height:40px;width:40px" id="mulBtn">X</button>
- <br/>
- <button style="height:40px;width:40px">4</button>
- <button style="height:40px;width:40px">5</button>
- <button style="height:40px;width:40px">6</button>
- <button style="height:40px;width:40px" id="subBtn">-</button>
- <br/>
- <button style="height:40px;width:40px">1</button>
- <button style="height:40px;width:40px">2</button>
- <button style="height:40px;width:40px">3</button>
- <button style="height:40px;width:40px" id="addBtn">+</button>
- <br/>
- <button style="height:40px;width:84px">0</button>
- <button style="height:40px;width:40px" id="decBtn">.</button>
- <button style="height:40px;width:40px" id="eqlBtn">=</button>
- <script type ="text/javascript">
- var myNum = 0;
- document.getElementById("output").innerHTML = myNum;
- document.getElementById("clrBtn").onclick = function() {buttonClick()};
- function buttonClick() {
- myNum = document.getElementById("clrBtn").innerHTML
- document.getElementById("output").innerHTML = myNum;
- console.log(myNum);
- }
- </script>
- </article>
- </section>
- <footer>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement