forked from PrakharShukla0/Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my.js
82 lines (82 loc) · 3.08 KB
/
my.js
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
document.getElementById('hello').addEventListener("click",function(){
document.getElementById('dinkar').href="style2.css";
});
document.getElementById('by').addEventListener("click",function(){
document.getElementById('dinkar').href="style1.css";
});
document.getElementById('tata').addEventListener("click",function(){
document.getElementById('dinkar').href="style3.css";
});
var string="";
document.getElementById('seven').addEventListener("click",function(){
string +="7";
document.getElementById('second').innerHTML=string;
});
document.getElementById('eight').addEventListener("click",function(){
string +="8";
document.getElementById('second').innerHTML=string;
});
document.getElementById('nine').addEventListener("click",function(){
string +="9";
document.getElementById('second').innerHTML=string;
});
document.getElementById('DEL').addEventListener("click",function(){
string=string.slice(0,-1);
document.getElementById('second').innerHTML=string;
});
document.getElementById('four').addEventListener("click",function(){
string +="4";
document.getElementById('second').innerHTML=string;
});
document.getElementById('five').addEventListener("click",function(){
string +="5";
document.getElementById('second').innerHTML=string;
});
document.getElementById('six').addEventListener("click",function(){
string +="6";
document.getElementById('second').innerHTML=string;
});
document.getElementById('add').addEventListener("click",function(){
string +="+";
document.getElementById('second').innerHTML=string;
});
document.getElementById('one').addEventListener("click",function(){
string +="1";
document.getElementById('second').innerHTML=string;
});
document.getElementById('two').addEventListener("click",function(){
string +="2";
document.getElementById('second').innerHTML=string;
});
document.getElementById('three').addEventListener("click",function(){
string +="3";
document.getElementById('second').innerHTML=string;
});
document.getElementById('subtract').addEventListener("click",function(){
string +="-";
document.getElementById('second').innerHTML=string;
});
document.getElementById('dot').addEventListener("click",function(){
string +=".";
document.getElementById('second').innerHTML=string;
});
document.getElementById('zero').addEventListener("click",function(){
string +="0";
document.getElementById('second').innerHTML=string;
});
document.getElementById('slash').addEventListener("click",function(){
string +="/";
document.getElementById('second').innerHTML=string;
});
document.getElementById('multiply').addEventListener("click",function(){
string += "*";
document.getElementById('second').innerHTML=string;
});
document.getElementById('RESET').addEventListener("click",function(){
string="";
document.getElementById('second').innerHTML='';
});
document.getElementById('equal').addEventListener("click",function(){
var god=eval(string);
document.getElementById('second').innerHTML=god;
})