-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.html
59 lines (55 loc) · 2.43 KB
/
calculator.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Calculator</title>
<style>
h1{
font-family:"Trebuchet Ms", Arial, Halvetica, sans-serif;
}
input[type="text"]{
width:350px;
height:50px;
font-size:36px;
text-align:right;
}
input[type="button"]{
width:75px;
height:75px;
font-size:24px;
}
</style>
</head>
<body>
<form name="Cal">
<table border="1px" align="center" cellspacing="5" cellpadding="5" rows="5" cols="4">
<tr><td colspan="4"><h1>Calculator in JavaScript</h1></td></tr>
<tr><td colspan="4"><input type="text" name="Screen" disabled></td></tr>
<tr>
<td><input type="button" name="" value="7" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="8" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="9" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="+" onClick="Cal.Screen.value +='+'"></td>
</tr>
<tr>
<td><input type="button" name="" value="4" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="5" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="6" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="-" onClick="Cal.Screen.value +='-'"></td>
</tr>
<tr>
<td><input type="button" name="" value="1" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="2" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="3" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="*" onClick="Cal.Screen.value +='*'"></td>
</tr>
<tr>
<td><input type="button" name="" value="C" onClick="Cal.Screen.value ='';"></td>
<td><input type="button" name="" value="0" onClick="Cal.Screen.value +=this.value"></td>
<td><input type="button" name="" value="=" onClick="Cal.Screen.value =eval(Cal.Screen.value)"></td>
<td><input type="button" name="" value="/" onClick="Cal.Screen.value +='/'"></td>
</tr>
</table>
</form>
</body>
</html>