-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (97 loc) · 2.77 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
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
97
98
99
<!DOCTYPE html>
<html>
<head>
<title>My online calculator</title>
<style>
table{
border:2px solid black;
width:33%;
background-color:grey;
}
td{
padding:10px;
height:100%;
color:white;
font-size: 20px;
}
input{
width:100%;
height:40px;
background-color:white;
}
button{
width:100%;
height:40px;
font-size: 20px;
}
button:hover{
color: #8AC007;
font-weight:bold;
}
.six{
/* padding: 0px;
background-color: cyan;
border: 0;
height: 100px; */
}
</style>
</head>
<body>
<script>
function number(value){
document.form1.result.value +=value;
}
function cle(value){
document.form1.result.value =value;
}
function evalua(){
//var evalu = eval(document.form1.result.value);
document.form1.result.value = eval(document.form1.result.value);
}
</script>
<form name="form1">
<table align="center">
<tr><td colspan="4">SIMPLE CALCULATOR</td></tr>
<tr><td colspan="4">
<input type = "text" name="result" placeholder="0" disabled style="text-align:right"></input>
</td></tr>
<tr>
<td><button type = "button" onclick="number(value)" value="1">1</button></td>
<td><button type = "button" onclick="number(value)" value="2">2</button></td>
<td><button type = "button" onclick="number(value)" value="3">3</button></td>
<td><button class="six" type = "button" onclick="number(value)" value="+">+</button></td>
</tr>
<tr>
<td><button type = "button" onclick="number(value)" value="4">4</button></td>
<td><button type = "button" onclick="number(value)" value="5">5</button></td>
<td><button type = "button" onclick="number(value)" value="6">6</button></td>
<td><button type = "button" onclick="number(value)" value="-">-</button></td>
</tr>
<tr>
<td><button type = "button" onclick="number(value)" value="7">7</button></td>
<td><button type = "button" onclick="number(value)" value="8">8</button></td>
<td><button type = "button" onclick="number(value)" value="9">9</button></td>
<td><button type = "button" onclick="number(value)" value="/">/</button></td>
</tr>
<tr>
<td><button type = "button" onclick="number(value)" value="."><strong>.</strong></button></td>
<td><button type = "button" onclick="number(value)" value="0">0</button></td>
<td><button type = "button" onclick="number(value)" value="*">*</button></td>
<td><button type = "button" onclick="number(value)" value="%">%</button></td>
</tr>
<tr>
<td colspan="2">
<button type = "button" onclick="cle(value)" value="">C</button></td>
<td colspan="2">
<button type = "button" onclick="evalua()">=</button>
</td>
<tr>
<td colspan="4">
<button style="" type="button">Test</button>
</td>
</tr>
</tr>
</table>
</form>
</body>
</html>