-
Notifications
You must be signed in to change notification settings - Fork 1
/
calc.html
96 lines (96 loc) · 2.89 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
<style>
body{
background-color: #777;
}
#calculator
{
background-color: rgb(0, 0,0);
margin-left: 30%;
margin-right: 30%;
height:600px;
padding-top:20px;
border-radius: 20px;
padding-bottom: 10px;
}
#dis
{
width: 410px;
heigth:460px;
font-size: 42px;
border-radius: 20px;
padding-left: 10px;
padding-right: 10px;
}
table {
margin-top: 20px;
}
button {
background-color: #bbb;
padding: .5em;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 6px;
color: #fff;
font-family: 'Oswald';
font-size: 20px;
text-decoration: none;
border: none;
width:100px;
height: 100px;
}
button:hover {
background: orange;
box-shadow: 0px 0px 1px #777;
}
</style>
</head>
<script>
var ins;
var int;
function calcc()
{
ins=eval(dis.value);
document.getElementById("dis").value=ins;
}
</script>
<body>
<div align="center" id="calculator">
<input type="text" id="dis" disabled/>
<table>
<tr>
<td><button onclick="dis.value+='+'" >+</button></td>
<td><button onclick="dis.value+='-'">-</button></td>
<td><button onclick="dis.value+='*'">*</button></td>
<td><button onclick="dis.value+='/'">/</button></td>
</tr>
<tr>
<td><button onclick="dis.value+='9'">9</button></td>
<td><button onclick="dis.value+='8'" >8</button></td>
<td><button onclick="dis.value+='7'">7</button></td>
<td><button onclick="dis.value+='('">(</button></td>
</tr>
<tr>
<td><button onclick="dis.value+='6'" >6</button></td>
<td><button onclick="dis.value+='5'">5</button></td>
<td><button onclick="dis.value+='4'" >4</button></td>
<td><button onclick="dis.value+=')'">)</button></td>
</tr>
<tr>
<td><button onclick="dis.value+='3'" >3</button></td>
<td><button onclick="dis.value+='2'">2</button></td>
<td><button onclick="dis.value+='1'">1</button></td>
<td><button onclick="dis.value+='%'">%(MOD)</button></td>
</tr>
<tr>
<td><button onclick="dis.value+='0'">0</button></td>
<td><button onclick="dis.value=''">C</button></td>
<td><button onclick="calcc()" >=</button></td>
<td><button onclick="dis.value+='.'">.</button></td>
</tr>
</table>
</div>
</body>
</html>