-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPROG1.html
22 lines (22 loc) · 1008 Bytes
/
PROG1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html>
<title>CALCULATOR</title>
<style>
input{ width:100%; padding:30px; } input:hover{background: silver;}
</style>
<body>
<div align="center">
<h2>SIMPLE CALCULATOR</h2>
<script type="text/javascript">
a = ['7','8','9','+','4','5','6','-','1','2','3','*','c','0','=','/']
z = '<td> <input type="button" value="'
document.write('<form name="cal"><table><tr><td colspan="8"> <input type="text" name="get"></td></tr><tr>');
for (var i = 0; i<16; i++) {
if(i==12){document.write('<td> <input type="reset" value="c" ></td>'); continue ;}
if(i==14){document.write('<td><input type="button" value="=" onclick="cal.get.value =eval(cal.get.value)"></td>');continue ;}
if(i==3||i==7||i==11){document.write(z+a[i]+'" onclick="cal.get.value +=\''+a[i]+'\'"></td></tr><tr rowspan="2">');continue ;}
else document.write(z+a[i]+'" onclick="cal.get.value +=\''+a[i]+'\'"></td>');
}
doument.write('</table></form></div>');
</script>
</body>
</html>