-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculator.js
More file actions
220 lines (180 loc) · 6.66 KB
/
calculator.js
File metadata and controls
220 lines (180 loc) · 6.66 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
const menuBar = document.querySelector(".menu_bar");
const menuBar2 = document.querySelector(".menu_bar2");
const calculators = document.querySelector(".disapdiv");
const body = document.querySelector("body");
const stands = document.querySelector(".stand");
const sciens = document.querySelector(".scien");
const graps = document.querySelector(".grap");
const progs = document.querySelector(".prog");
const standardCalculator = document.querySelector(".mystandards");
const trigonometry = document.querySelector(".trigo");
const myFunction = document.querySelector(".func");
const insideTrigono = document.querySelector(".insidetri");
const insideFunc = document.querySelector(".insidfuc");
const scientificCalculator = document.querySelector(".scien_calculates");
const calscience = document.querySelector(".insidetrifunc");
const calscience2 = document.querySelector(".sciensecalculator");
const inputNumberTop = document.getElementById("myspan");
const inputNumber = document.getElementById("myindiv");
const clickNumbers = document.querySelector(".btndiv2");
const myPlusMinus = document.getElementById ("plusmins");
const dot = document.querySelector(".standot");
const standard = document.querySelector(".standards");
const scientific = document.querySelector(".sciences");
const graph = document.querySelector(".graphs");
const program = document.querySelector(".programs");
menuBar.onclick = function (){
calculators.style.transform = "scale(1)";
menuBar.style.display = "none";
menuBar2.style.display = "block";
}
menuBar2.onclick = function (){
calculators.style.transform ="scale(0)";
menuBar.style.display = "block";
menuBar2.style.display = "none";
}
// body.onclick = function (){
// calculators.style.display = "none";
// }
stands.onclick = function (){
standard.style.display = "block";
scientific.style.display = "none";
graph.style.display = "none";
program.style.display = "none";
calculators.style.transform = "scale(0)";
menuBar2.style.display = "none";
menuBar.style.display = "block";
standardCalculator.style.display = "block";
scientificCalculator.style.display = "none";
}
sciens.onclick = function (){
scientific.style.display = "block";
standard.style.display = "none";
graph.style.display = "none";
program.style.display = "none";
calculators.style.transform = "scale(0)";
menuBar2.style.display = "none";
menuBar.style.display = "block";
standardCalculator.style.display = "none";
scientificCalculator.style.display = "block";
}
graps.onclick = function (){
graph.style.display = "block";
standard.style.display = "none";
scientific.style.display = "none";
program.style.display = "none";
calculators.style.transform = "scale(0)";
menuBar2.style.display = "none";
menuBar.style.display = "block";
standardCalculator.style.display = "none";
scientificCalculator.style.display = "none";
}
progs.onclick = function (){
program.style.display = "block";
standard.style.display = "none";
scientific.style.display = "none";
graph.style.display = "none";
calculators.style.transform = "scale(0)";
menuBar2.style.display = "none";
menuBar.style.display = "block";
standardCalculator.style.display = "none";
scientificCalculator.style.display = "none";
}
window.onload = function (){
standard.style.display = "block";
standardCalculator.style.display = "block";
inputNumber.value = "";
}
trigonometry.onclick = function (){
insideTrigono.style.display = "block";
insideTrigono.style.width = "80%";
insideFunc.style.display = "none";
}
myFunction.onclick = function (){
insideFunc.style.display = "block";
insideFunc.style.width = "70%";
insideFunc.style.marginLeft= "6rem";
insideTrigono.style.display = "none";
}
calscience.onclick = function (){
insideTrigono.style.display = "none";
insideFunc.style.display = "none";
}
calscience2.onclick = function (){
insideTrigono.style.display = "none";
insideFunc.style.display = "none";
}
function number(values) {
inputNumberTop.value+= values;
}
function number(values) {
inputNumber.value+= values;
}
function clea() {
// inputNumber.value = "";
// var myClear = document.getElementById("myindiv").value = " ";
document.getElementById("myindiv").value = " ";
}
function evalu () {
var myEqual = document.getElementById("myindiv").value;
// var myEvalu = eval(myEqual);
document.getElementById("myindiv").value = eval(myEqual);
}
function mysquare() {
var mySquar = document.getElementById("myindiv").value;
var sq = Math.pow(mySquar,2);
document.getElementById("myindiv").value = sq;
}
function mysquareroot() {
var myRoot = document.getElementById("myindiv").value;
var sr = Math.sqrt(myRoot);
document.getElementById("myindiv").value = sr;
}
function dele(){
var inp = document.getElementById('myindiv').value;
var inp2 = inp.length;
var others = inp.slice(0, inp2-1);
// var last = inp.slice(inp2);
// alert(others);
document.getElementById('myindiv').value = others;
}
myPlusMinus.onclick = function (){
}
function percentage(){
var perc = document.getElementById('myindiv').value;
var toPerce = perc/100;
document.getElementById('myindiv').value = toPerce;
}
function myoverx() {
var oneoverx = document.getElementById('myindiv').value;
var theresultss = 1/oneoverx;
document.getElementById('myindiv').value = theresultss;
}
function mysin() {
var myTrisin = document.getElementById("myindiv").value;
document.getElementById("myindiv").value =Math.sin(myTrisin);
}
function mycos() {
var myTricos = document.getElementById("myindiv").value;
document.getElementById("myindiv").value =Math.cos(myTricos);
}
function mytan() {
var myTritan = document.getElementById("myindiv").value;
document.getElementById("myindiv").value =Math.tan(myTritan);
}
function myhypo() {
var myTrihypo = document.getElementById("myindiv").value;
document.getElementById("myindiv").value =Math.hypot(myTrihypo);
}
// function myseco() {
// var myTrisecs = document.getElementById("myindiv").value;
// document.getElementById("myindiv").value =Math.(myTrisecs);
// }
function dele2(){
var inpd = document.getElementById('myindiv').value;
var inp2d = inpd.length;
var othersd = inpd.slice(0, inp2d-1);
// var last = inp.slice(inp2);
// alert(others);
document.getElementById('myindiv').value = othersd;
}