├── README.md ├── calc.css ├── calc.html └── calc.js /README.md: -------------------------------------------------------------------------------- 1 | # javascriptcalculator -------------------------------------------------------------------------------- /calc.css: -------------------------------------------------------------------------------- 1 | .title{ 2 | margin:auto; 3 | text-align:center; 4 | width: 300px; 5 | padding:10px; 6 | color:black; 7 | font-size: 30px; 8 | font-family: monospace; 9 | border: solid black 4px; 10 | } 11 | 12 | input[type="button"] 13 | { 14 | background-color:white; 15 | color: black; 16 | font-size: 30px; 17 | 18 | width:80px; 19 | height:60px; 20 | } 21 | 22 | input[type="text"] 23 | { 24 | background-color:white; 25 | border: solid black 2px; 26 | width:100%; 27 | height:60px; 28 | font-size: 20px; 29 | } 30 | -------------------------------------------------------------------------------- /calc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | javascript calculator 6 | 7 | 8 | 9 |
Calculator
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /calc.js: -------------------------------------------------------------------------------- 1 | function dis(val) 2 | { 3 | document.getElementById("result").value+=val 4 | } 5 | 6 | //function that evaluates the digit and return result 7 | function solve() 8 | { 9 | let x = document.getElementById("result").value 10 | let y = eval(x) 11 | document.getElementById("result").value = y 12 | } 13 | 14 | //function that clear the display 15 | function clr() 16 | { 17 | document.getElementById("result").value = "" 18 | } 19 | --------------------------------------------------------------------------------