-
Notifications
You must be signed in to change notification settings - Fork 0
/
prog7.html
58 lines (58 loc) · 2.59 KB
/
prog7.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
<html>
<head>
<title>Calculator</title>
<style>
table{
background-color:transparent;
}
</style>
<script>
function display(x){
document.getElementById("text1").value+=x;
}
function compute(){
var x=document.getElementById("text1").value;
document.getElementById("text1").value=eval(x);
}
</script>
</head>
<body>
<center>
<form>
<table border="1" cellspacing="8" cellpadding="8">
<tr><th colspan="4">Calculator</th></tr>
<tr>
<td colspan="4"><input type="text" id="text1" placeholder="0" style="text-align:right;"></td>
</tr>
<tr>
<td><input type="reset" value="C"></td>
<td><input type="button" value="/" onclick="display(this.value)"></td>
<td><input type="button" value="*" onclick="display(this.value)"></td>
<td><input type="button" value="-" onclick="display(this.value)"></td>
</tr>
<tr>
<td><input type="button" value="7" onclick="display(this.value)"></td>
<td><input type="button" value="8" onclick="display(this.value)"></td>
<td><input type="button" value="9" onclick="display(this.value)"></td>
<td rowspan="2"><input type="button" value="+" onclick="display(this.value)"></td>
</tr>
<tr>
<td><input type="button" value="4" onclick="display(this.value)"></td>
<td><input type="button" value="5" onclick="display(this.value)"></td>
<td><input type="button" value="6" onclick="display(this.value)"></td>
</tr>
<tr>
<td><input type="button" value="1" onclick="display(this.value)"></td>
<td><input type="button" value="2" onclick="display(this.value)"></td>
<td><input type="button" value="3" onclick="display(this.value)"></td>
<td rowspan="2"><input type="button" value="=" onclick="compute()"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="0" onclick="display(this.value)"></td>
<td><input type="button" value="." onclick="display(this.value)"></td>
</tr>
</table>
</form>
</center>
</body>
</html>