-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (41 loc) · 1.79 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
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<form name="cal">
<input type="text" class="search" name="text"><br><br>
<input type="button" name="clear" value=C onclick="text.value = '' ">
<input type="button" name="back" value="<"
onclick="cal.text.value = cal.text.value.substring(0,cal.text.value.length-1)"><br>
<input type="button" name="btn9" value=9 onclick="show(btn9.value)">
<input type="button" name="btn8" value=8 onclick="show(btn8.value)">
<input type="button" name="btn7" value=7 onclick="show(btn7.value)">
<input type="button" name="divide" value=/ onclick="show(divide.value)"><br>
<input type="button" name="btn6" value=6 onclick="show(btn6.value)">
<input type="button" name="btn5" value=5 onclick="show(btn5.value)">
<input type="button" name="btn4" value=4 onclick="show(btn4.value)">
<input type="button" name="mul" value=* onclick="show(mul.value)"><br>
<input type="button" name="btn3" value=3 onclick="show(btn3.value)">
<input type="button" name="btn2" value=2 onclick="show(btn2.value)">
<input type="button" name="btn1" value=1 onclick="show(btn1.value)">
<input type="button" name="sub" value=- onclick="show(sub.value)"><br>
<input type="button" name="btn0" value=0 onclick="show(btn0.value)">
<input type="button" name="dout" value=. onclick="show(dout.value)">
<input type="button" name="equal" class="eql" value="=" onclick="text.value=eval(text.value)">
<input type="button" name="add" value=+ onclick="show(add.value)">
</form>
</div>
<script type="text/javascript">
function show(n) {
cal.text.value = cal.text.value + n;
}
function back(n) {
cal.text.value = cal.text.value - n;
}
</script>
</body>
</html>