/
index.html
60 lines (53 loc) · 2.15 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
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="computation.js"></script>
</head>
<body id = "whole">
<div id="header">
<h1>Calculator</h1>
<h2>Enter a valid expression</h2>
</div>
<div id="body">
<p id="answer"></p>
<form name="expression">
<input type="text" name="expression">
<input type="button" value="Submit" onclick="compute()">
<table align = "center">
<td><input type=button value="u" onclick="expression.value+=Math.floor(Math.random()*42)"></td>
<td><input type=button value="C" onclick="expression.value=''"></td>
<td><input type=button value="/" onclick="expression.value+='/'"></td>
<td><input type=button value="π" onclick="expression.value+=3.1416"></td>
<tr>
<td><input type=button value="+" onclick="expression.value+='+'"></td>
<td><input type=button value="-" onclick="expression.value+='-'"></td>
<td><input type=button value="X" onclick="expression.value+='*'"></td>
<td><input type=button value="(" onclick="expression.value+='('"></td>
<td><input type=button value=")" onclick="expression.value+=')'"></td>
<td><input type=button value="√" onclick="expression.value='Math.sqrt('"></td>
</tr>
<tr>
<td><input type=button value="0" onclick="expression.value+='0'"></td>
<td><input type=button value="1" onclick="expression.value+='1'"></td>
<td><input type=button value="2" onclick="expression.value+='2'"></td>
<td><input type=button value="3" onclick="expression.value+='3'"></td>
</tr>
<tr>
<td><input type=button value="4" onclick="expression.value+='4'"></td>
<td><input type=button value="5" onclick="expression.value+='5'"></td>
<td><input type=button value="6" onclick="expression.value+='6'"></td>
</tr>
<tr>
<td><input type=button value="7" onclick="expression.value+='7'"></td>
<td><input type=button value="8" onclick="expression.value+='8'"></td>
</tr>
<tr>
<td><input type=button value="9" onclick="expression.value+='9'"></td>
</tr>
</table>
</form>
</div>
</body>
</html>