-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.html
More file actions
53 lines (52 loc) · 3.11 KB
/
calculator.html
File metadata and controls
53 lines (52 loc) · 3.11 KB
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="calc.css">
</head>
<body>
<form name="calculator">
<table>
<tr>
<td><input type="text" name="display" id="display" disabled></td>
</tr>
<tr id="line1">
<td><input type="button" id="clear" name="clear" value="C" onclick="calculator.display.value += ''"></td>
<td><input type="button" name="fracton" value="+/-" onclick="calculator.display.value += '+/-'"></td>
<td><input type="button" name="modulos" value="%" onclick="calculator.display.value += '%'"></td>
<td><input type="button" id="color" name="divide" value="/" onclick="calculator.display.value += '/'"></td>
</tr>
<tr id="line2">
<td><input type="button" name="seven" value="7" onclick="calculator.display.value += '7'"></td>
<td><input type="button" name="eight" value="8" onclick="calculator.display.value += '8'"></td>
<td><input type="button" name="nine" value="9" onclick="calculator.display.value += '9'"></td>
<td><input type="button" id="color" name="multiply" value='x' onclick="calculator.display.value += '*'"></td>
</tr>
<tr id="line3">
<td><input type="button" name="four" value="4" onclick="calculator.display.value += '4'"></td>
<td><input type="button" name="five" value="5" onclick="calculator.display.value += '5'"></td>
<td><input type="button" name="six" value="6" onclick="calculator.display.value += '6'"></td>
<td><input type="button" id="color" name="minus" value='-' onclick="calculator.display.value += '-'"></td>
</tr>
<tr id="line4">
<td><input type="button" name="one" value="1" onclick="calculator.display.value += '1'"></td>
<td><input type="button" name="two" value="2" onclick="calculator.display.value += '2'"></td>
<td><input type="button" name="three" value="3" onclick="calculator.display.value += '3'"></td>
<td><input type="button" id="color" name="add" value='+' onclick="calculator.display.value += '+'"></td>
</tr>
<tr id="num0">
<td><input type="button" name="zero" value="0" onclick="calculator.display.value += '0'"></td>
</tr>
<tr id="line5">
<td><input type="button" name="decimal point" value="." onclick="calculator.display.value += '.'"></td>
<td><input type="button" id="color" name="equals" value="=" onclick="calculator.display.value = eval(calculator.display.value)"></td>
</tr>
</table>
</form>
</body>
<script>
document.getElementById("clear").addEventListener('click', (e) => {
document.getElementById("display").value = "";
});
let numers = []
</script>
</html>