-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.html
119 lines (113 loc) · 4.75 KB
/
calculator.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<style>
.col{
border-style: solid;
border-width: 2px;
background-color:gray;
}
.col:hover{
background-color: dimgray;
cursor: pointer;
}
#homePic:hover{
cursor: pointer;
}
#leaderboard{
background-color:white;
}
</style>
<script src = "calculator.js"></script>
<div class="container align-items-center">
<img src ="home.png" id ="homePic" alt = "Click here for home page" onclick="relocateToHome()")>
<h1 class="text-center">Calculator</h1>
<div class="col-md-6 offset-md-3" style="margin-top: 8%; border-style: solid; border-width: 2px;">
<div class="row justify-content-evenly">
<div class = "row justify-content-center">
<div class="col" id = "leaderboard">
<h1 class="text-end" id = "fnum">0</h1>
</div>
</div>
<div class="row justify-content-center">
<div class="col" id = "9" onclick="appendNum(9)">
<h2 class = text-center >9</h2>
</div>
<div class="col" id = "8" onclick="appendNum(8)">
<h2 class = text-center > 8</h2>
</div>
<div class="col" id = "7" onclick="appendNum(7)">
<h2 class = text-center >7</h2>
</div>
<div class="col">
<!-- <img src = "backspace.png" alt = "Erase" style="margin-left: 30%; margin-top: 10%;"> -->
</div>
<div class="col">
<h2 class = text-center onclick="clickSymbol('-')">-</h2>
</div>
</div>
<div class="row justify-content-center">
<div class="col" id = "6" onclick="appendNum(6)">
<h2 class = text-center>6</h2>
</div>
<div class="col" id = "5" onclick="appendNum(5)">
<h2 class = text-center>5</h2>
</div>
<div class="col" id = "4" onclick="appendNum(4)">
<h2 class = text-center >4</h2>
</div>
<div class="col" onclick="clickSymbol('+')">
<h2 class = text-center >+</h2>
</div>
<div class="col" onclick="clickSymbol('/')">
<h2 class = text-center >/</h2>
</div>
</div>
<div class="row justify-content-center">
<div class="col" id = "3" onclick="appendNum(3)">
<h2 class = text-center >3</h2>
</div>
<div class="col" id = "2" onclick="appendNum(2)">
<h2 class = text-center >2</h2>
</div>
<div class="col" id = "1" onclick="appendNum(1)">
<h2 class = text-center >1</h2>
</div>
<div class="col" onclick="clickSymbol('x')">
<h2 class = text-center>x</h2>
</div>
<div class="col" onclick="reset()">
<h2 class = text-center >C</h2>
</div>
</div>
<div class="row justify-content-center">
<div class="col" onclick="clickSymbol('%')">
<h2 class = text-center id = "%">%</h2>
</div>
<div class="col">
<h2 class = text-center id = "0" onclick="appendNum(0)">0</h2>
</div>
<div class="col" onclick="addDecimal()">
<h2 class = text-center>.</h2>
</div>
<div class="col">
<h2 class = text-center onclick="result()">=</h2>
</div>
<div class="col" onclick="square()">
<h2 class = text-center>x²</h2>
</div>
</div>
</div>
</div>
<br>
<button type="button" onclick="javascript:location.href = 'bmiCalculator.html'" class="btn btn-primary" style="margin-left: 45%;">BMI Calculator</button>
</div>
</body>
</html>