-
Notifications
You must be signed in to change notification settings - Fork 0
/
java_calculator.html
86 lines (75 loc) · 3.72 KB
/
java_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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Javascript claculator</title>
</head>
<body>
<!--
this is a simple Calculate using the simple math Operators (+, -, /, *, and %)
only three functions where created :
-function takeValue(x),
-function clearInput(y),
-function calculateResult()
-->
<div class="container">
<div class="mycalc">
<form name="calculator" id="calculator">
<input type="text" name="inputwindow" id="inputwindow" readonly>
<div>
<input type="button" id="plus" value="+" onclick="takeValue(document.getElementById('plus').value)">
<input type="button" id="minus" value="-" onclick="takeValue(document.getElementById('minus').value)">
<input type="button" id="by" value="*" onclick="takeValue(document.getElementById('by').value)">
<input type="button" id="devide" value="/" onclick="takeValue(document.getElementById('devide').value)">
</div>
<div class="row-col">
<div class="col">
<div>
<input type="button" id="one" value="1"
onclick="takeValue(document.getElementById('one').value)">
<input type="button" id="two" value="2"
onclick="takeValue(document.getElementById('two').value)">
<input type="button" id="three" value="3"
onclick="takeValue(document.getElementById('three').value)">
</div>
<div>
<input type="button" id="four" value="4"
onclick="takeValue(document.getElementById('four').value)">
<input type="button" id="five" value="5"
onclick="takeValue(document.getElementById('five').value)">
<input type="button" id="six" value="6"
onclick="takeValue(document.getElementById('six').value)">
</div>
<div>
<input type="button" id="seven" value="7"
onclick="takeValue(document.getElementById('seven').value)">
<input type="button" id="eight" value="8"
onclick="takeValue(document.getElementById('eight').value)">
<input type="button" id="nine" value="9"
onclick="takeValue(document.getElementById('nine').value)">
</div>
<div>
<input type="button" id="zero" value="0"
onclick="takeValue(document.getElementById('zero').value)">
<input type="button" id="decimal" value="."
onclick="takeValue(document.getElementById('decimal').value)">
<input type="button" id="percent" value="%"
onclick="takeValue(document.getElementById('percent').value)">
</div>
</div>
<div class="col-1">
<div class="results">
<input type="button" id="equal" value="=" onclick="calculateResult()">
<button type="button" id="clear" value=""
onclick="clearInput(document.getElementById('clear').value)">
Clear
</button>
</div>
</div>
</div>
<script src="main.js"></script>
</form>
</div>
</body>
</html>