-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc.html
47 lines (45 loc) · 1.32 KB
/
calc.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
<html>
<head>
</head>
<body>
<script>
function insert(num){
document.form.textView.value=document.form.textView.value+num;
}
function equal(){
var exp = document.form.textView.value;
if(exp){
document.form.textView.value=eval(document.form.textView.value);
}
}
function c(){
document.form.textView.value=" ";
}
</script>
<center>
<form name="form">
<input type="text" name="textView"/><br>
<input type="button" value="1" onclick="insert(1)"/>
<input type="button" value="2" onclick="insert(2)"/>
<input type="button" value="3" onclick="insert(3)"/>
<input type="button" value="+" onclick="insert('+')"/>
<br><br>
<input type="button" value="4" onclick="insert(4)"/>
<input type="button" value="5" onclick="insert(5)"/>
<input type="button" value="6" onclick="insert(6)"/>
<input type="button" value="-" onclick="insert('-')"/>
<br><br>
<input type="button" value="6" onclick="insert(6)"/>
<input type="button" value="7" onclick="insert(7)"/>
<input type="button" value="8" onclick="insert(8)"/>
<input type="button" value="*" onclick="insert('*')"/>
<br><br>
<input type="button" value="0" onclick="insert(0)"/>
<input type="button" value="/" onclick="insert('/')"/>
<input type="button" value="=" onclick="equal()"/>
<input type="button" value="C" onclick="c()"/>
<br>
</form>
</center>
</body>
</html>