-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.html
46 lines (43 loc) · 2.46 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1 class="title">Online Calculator</h1>
<h2>By:- Safdar Ansari</h2>
<form name="form1" class="calci" action="calculator.html" method="POST">
<input type="text" name="answer" id="display" readonly>
<br>
<input type="button" value="C" onclick="form1.answer.value=''" class="button clear">
<input type="button" class="button backspace" value="←"
onclick="form1.answer.value=form1.answer.value.substring(0,form1.answer.value.length*1-1)">
<input type="button" class="button" value="00" onclick="form1.answer.value+='00'">
<input type="button" class="operator" value="/" onclick="form1.answer.value+='/'">
<br>
<input type="button" class="button" value="7" onclick="form1.answer.value+='7'">
<input type="button" class="button" value="8" onclick="form1.answer.value+='8'">
<input type="button" class="button" value="9" onclick="form1.answer.value+='9'">
<input type="button" class="operator" value="*" onclick="form1.answer.value+='*'">
<br>
<input type="button" class="button" value="4" onclick="form1.answer.value+='4'">
<input type="button" class="button" value="5" onclick="form1.answer.value+='5'">
<input type="button" class="button" value="6" onclick="form1.answer.value+='6'">
<input type="button" class="operator" value="-" onclick="form1.answer.value+='-'">
<br>
<input type="button" class="button" value="1" onclick="form1.answer.value+='1'">
<input type="button" class="button" value="2" onclick="form1.answer.value+='2'">
<input type="button" class="button" value="3" onclick="form1.answer.value+='3'">
<input type="button" class="operator" value="+" onclick="form1.answer.value+='+'">
<br>
<input type="button" class="button" value="0" onclick="form1.answer.value+='0'" id="zero">
<input type="button" class="button" value="." onclick="form1.answer.value+='.'">
<input type="button" class="operator" value="=" onclick="form1.answer.value=eval(form1.answer.value)">
</form>
</div>
</body>
</html>