-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calc.html
170 lines (158 loc) · 5.11 KB
/
Calc.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calc Calculator</title>
</head>
<style>
body{
background: linear-gradient(95deg, black 10%, #545454 55%, black 90%);
}
.pannel{
margin: 10px;
justify-content: space-between;
color: rgb(185, 208, 251);
padding-top: 5px;
padding-bottom: 10px;
}
.solar{
position: absolute;
width: 100px;
height:40px;
border: 2px solid rgb(204, 218, 240);
border-radius: 5px;
background-color: #252525;
margin: 0px 8px 10px 10px;
box-shadow: inset 3px 2px 5px 0px #8a8a41b8;
}
h1{
padding-left: 22px;
margin: 0px;
}
.main{
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center baseline;
margin: 10% 25%;
width: 320px;
height: 545px;
border: solid 2px #313751;
border-radius: 20px;
background-color: rgb(40, 39, 47);
box-shadow: inset -1px 0px 5px 0px #a5a9fcbc;
}
.form{
width:300px;
height:370px;
align-content: center;
margin:0px 8px 8px 8px;
align-items:end;
}
#del{
width: 145px;
}
.input{
border:3px solid #5b5c6dbb;
position: relative;
width: 260px;
height: 100px;
border-radius: 18px 18px 5px 5px;
margin-bottom: 18px;
margin-top: 5px;
font-size:xx-large;
padding: 10px;
background-color: #4b4b4dca;
color: #fcfcfc;
}
button{
border-radius:6px;
width:72px;
height:50px;
font-size:large;
}
button:hover{
background-color: orangered;
color: white;
border: 4px solid #ff5a1e;
}
</style>
<body>
<div class="main">
<center>
<div class="pannel">
<div class="solar">
<div></div>
<div></div>
<div></div>
</div>
<div><h1>Casio</h1><p style="position: absolute;right:30px;top:15px;">fx-991Ms</p></div>
</div>
<div class="form">
<input class="input" id="input" placeholder="0"><br>
<table>
<div class="keys">
<tr>
<button onclick="clr('c')" class="key">c</button>
<button onclick="display('/')" class="operator">/</button>
<button onclick="display('(')" class="brace">(</button>
<button onclick="display(')')" class="brace">)</button><br>
</tr>
<tr>
<button onclick="display('7')" class="key">7</button>
<button onclick="display('8')" class="key">8</button>
<button onclick="display('9')" class="key">9</button>
<button onclick="display('+')" class="operator">+</button><br>
</tr>
<tr>
<button onclick="display('4')" class="key">4</button>
<button onclick="display('5')" class="key">5</button>
<button onclick="display('6')" class="key">6</button>
<button onclick="display('-')" class="operator">-</button><br>
</tr>
<tr>
<button onclick="display('1')" class="key">1</button>
<button onclick="display('2')" class="key">2</button>
<button onclick="display('3')" class="key">3</button>
<button onclick="display('*')" class="operator">*</button><br>
</tr>
<tr>
<button onclick="display('0')" class="key">0</button>
<button onclick="display('.')" class="decimal">.</button>
<button onclick="calculate('=')" class="calculate" style="background-color: #fe6128; color: #fcfcfc;">=</button>
<button onclick="display('%')" class="operator">%</button><br>
<button onclick="display('100')" class="key">100</button>
<button onclick="display('00')" class="key">00</button>
<button onclick="back()" class="operator" id="del">Del</button>
</tr>
</div>
</table>
</div>
</center>
</div>
</body>
<script>
let output = document.getElementById("input");
function display(num)
{
output.value+= num;
}
function calculate(){
try{
output.value=eval(output.value);
}
catch(error)
{
alert("Invalid");
}
}
function clr(){
output.value="";
}
function back(){
var value=document.getElementById("del").value;
document.getElementById("input").value= value.substr( value.length-1);
}
</script>
</html>