forked from code-differently/JS-Calculator-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstandard.js
More file actions
38 lines (32 loc) · 1.07 KB
/
standard.js
File metadata and controls
38 lines (32 loc) · 1.07 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
function clk(val){
document.getElementById('calfield').value=document.getElementById('calfield').value+val;
}
function clk(val){
document.getElementById('calfield2').value=document.getElementById('calfield2').value+val; //scientific cal
}
function clrdisp(){
document.getElementById('calfield').value="";
}
function clrdisp(){
document.getElementById('calfield2').value=""; //scietific cal
}
function eql(){
var text=document.getElementById('calfield').value;
var result=eval(text);
document.getElementById('calfield').value=result;
}
function eql(){
var text=document.getElementById('calfield2').value; //scientific cal
var result=eval(text);
document.getElementById('calfield2').value=result;
}
function cos() {
var text=document.getElementById('calfield').value;
var result=Math.cos(text);
document.getElementById('calfield').value=result;
}
function sin() {
var text=document.getElementById('calfield').value;
var result=Math.sin(text);
document.getElementById('calfield').value=result;
}