-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathindex.html
80 lines (44 loc) · 2.86 KB
/
index.html
1
2
3
4
5
6
7
8
9
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale = 1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<title>Calculator</title>
<link type="text/css" href="main.css" rel="stylesheet">
</head>
<body>
<h1>Simple Calculator to Calculate Anything</h1>
<div class="container">
<div class="output">
<input maxlength="20" id="display" type="text" name="answer" autofocus>
</div>
<div class="keyboard">
<button id="CE" onclick="document.getElementById('display').value = display.value.slice(0,-1)">CE</button>
<button id="clear" onclick="document.getElementById('display').value =''">C</button>
<button id="div" onclick="document.getElementById('display').value += '/'">/</button>
<button id="mod" onclick="document.getElementById('display').value += '%'">%</button>
<button id="one" onclick="document.getElementById('display').value +='1'">1</button>
<button id="two" onclick="document.getElementById('display').value +='2'">2</button>
<button id="three" onclick="document.getElementById('display').value +='3'">3</button>
<button id="add" onclick="document.getElementById('display').value +='+'">+</button>
<button id="four" onclick="document.getElementById('display').value +='4'">4</button>
<button id="five" onclick="document.getElementById('display').value +='5'">5</button>
<button id="six" onclick="document.getElementById('display').value +='6'">6</button>
<button id="minus" onclick="document.getElementById('display').value +='-'">-</button>
<button id="seven" onclick="document.getElementById('display').value +='7'">7</button>
<button id="eight" onclick="document.getElementById('display').value +='8'">8</button>
<button id="nine" onclick="document.getElementById('display').value +='9'">9</button>
<button id="multiply" onclick="document.getElementById('display').value +='*'">*</button>
<!-- disableb the button so that the hover effect to be changed for disableb buttons -->
<button disabled class="noHover"></button>
<button id="zero" onclick="document.getElementById('display').value +='0'">0</button>
<button id="power" onclick="document.getElementById('display').value +='**'">^</button>
<button id="equal" type="submit" onclick="calculate(display.value)">=</button>
</div>
</div>
<script type="text/javascript" src="script.js">
</script>
</body>
</html>