-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.html
68 lines (65 loc) · 2.69 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Calculator</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container-cal cal-bg">
<form name="form">
<div>
<div class="display-items">
<input type="text" placeholder="0" name="displayResult" />
</div>
</div>
<div class="button-items">
<div class="d-flex my-2">
<input class="btn" type="button" name="b7" value="7" onclick="func(b7.value)">
<input class="btn" type="button" name="b8" value="8" onclick="func(b8.value)">
<input class="btn" type="button" name="b9" value="9" onclick="func(b9.value)">
<input class="btn" type="button" name="plus" value="+" onclick="func(plus.value)">
</div>
<div class="d-flex my-2">
<input type="button" class="btn btn-primary" name="b4" value="4" onclick="func(b4.value)" />
<input type="button" class="btn btn-primary" name="b5" value="5" onclick="func(b5.value)" />
<input type="button" class="btn btn-primary" name="b6" value="6" onclick="func(b6.value)" />
<input
type="button" class="btn btn-primary"
name="minus"
value="-"
onclick="func(minus.value)"
/>
</div>
<div class="d-flex my-2">
<input type="button" class="btn btn-primary" name="b1" value="1" onclick="func(b1.value)" />
<input type="button" class="btn btn-primary" name="b2" value="2" onclick="func(b2.value)" />
<input type="button" class="btn btn-primary" name="b3" value="3" onclick="func(b3.value)" />
<input
type="button" class="btn btn-primary"
name="mul"
value="*"
onclick="func(mul.value)"
/>
</div>
<div class="d-flex my-2">
<input type="button" class="btn btn-primary" name="b0" value="0" onclick="func(b0.value)" />
<input type="button" class="btn btn-primary" name="bd" value="." onclick="func(bd.value)" />
<input type="button" class="btn btn-primary" name="divv" value="/" onclick="func(divv.value)" />
<input
type="button" class="btn btn-primary"
name="plus"
value="="
onclick="displayResult.value = eval(displayResult.value)"
/>
</div>
</div>
</form>
<script>
function func(result){
form.displayResult.value=form.displayResult.value+ result
}
</script>
</div>
</body>
</html>