-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
65 lines (58 loc) · 2.25 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
<html>
<head>
<meta charset="utf-8">
<title>JavaSctipt Calculator | Web Dev Trick</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script>
function calcNumbers(result){
form.displayResult.value=form.displayResult.value+result;
}
function clearResult(){
var result = document.getElementById("input");
result.value = " ";
}
</script>
<center style="margin-top: 10px;"><u style="color: cadetblue;">
<h1 style="color: rgb(118, 16, 252); font-family: fantasy;">CALCULATOR APP 🧮</h1>
</u>
</center>
<div class="container">
<form name="form">
<div class="display">
<input type="text" id="input" placeholder="0" name="displayResult" />
</div>
<div class="buttons">
<div class="row">
<input type="button" name="b7" value="7" onClick="calcNumbers(b7.value)">
<input type="button" name="b8" value="8" onClick="calcNumbers(b8.value)">
<input type="button" name="b9" value="9" onClick="calcNumbers(b9.value)">
<input type="button" name="addb" value="+" onClick="calcNumbers(addb.value)">
</div>
<div class="row">
<input type="button" name="b4" value="4" onClick="calcNumbers(b4.value)">
<input type="button" name="b5" value="5" onClick="calcNumbers(b5.value)">
<input type="button" name="b6" value="6" onClick="calcNumbers(b6.value)">
<input type="button" name="subb" value="-" onClick="calcNumbers(subb.value)">
</div>
<div class="row">
<input type="button" name="b1" value="1" onClick="calcNumbers(b1.value)">
<input type="button" name="b2" value="2" onClick="calcNumbers(b2.value)">
<input type="button" name="b3" value="3" onClick="calcNumbers(b3.value)">
<input type="button" name="mulb" value="*" onClick="calcNumbers(mulb.value)">
</div>
<div class="row">
<input type="button" name="b0" value="0" onClick="calcNumbers(b0.value)">
<input type="button" name="potb" value="." onClick="calcNumbers(potb.value)">
<input type="button" name="divb" value="/" onClick="calcNumbers(divb.value)">
<input type="button" class="red" value="=" onClick="displayResult.value=eval(displayResult.value)">
</div>
<div class="row">
<input type="button" class="green" id="clear" value="C" onClick="clearResult()">
</div>
</div>
</form>
</div>
</body>
</html>