-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
145 lines (126 loc) · 4.87 KB
/
index.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
<html>
<head>
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">
</head>
<style>
body{
background-color: black;}
.calc{
margin-left: 38%;
margin-right: 41%;
margin-top: 210px;
border-radius: 20px;
background-color: #D42E0B;
padding: 20px;
}
.calc:hover{
margin-left: 38%;
margin-right: 41%;
margin-top: 207px;
border-radius: 20px;
padding: 20px;
}
.btn{
padding:5px;
width: 50px;
height: 50px;
padding-left: 5px;
border-radius: 50px;
margin: 3px;
font-weight: bold;
}
.btn:hover{
box-shadow: 5px 5px 10px #333;
}
#inp{
width: 230px;
height: 50px;
font-weight: bold;
border-radius: 20px;
background-color: black;
border-color: black;
color: white;
padding: 10px;
}
.btneq{
padding:5px;
width: 50px;
height: 50px;
padding-left: 5px;
border-radius: 50px;
background-color: BLACK;
COLOR: WHITE;
border-color:#D42E0B;
}
.bod{
margin: 15px;
padding: 10px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<body>
<div class="calc" data-aos="fade-up" id="calc">
<div class="bod" id="dataa">
<form>
<input type="text" id="inp" disabled><br><br>
<input type="button" value="1" class='btn' onclick="appen(1)">
<input type="button" value="2" class='btn' onclick="appen(2)">
<input type="button" value="3" class='btn' onclick="appen(3)">
<input type="button" value="C" class='btn' onclick="cl()">
<br><br>
<input type="button" value="4" class='btn' onclick="appen(4)">
<input type="button" value="5" class='btn' onclick="appen(5)">
<input type="button" value="6" class='btn' onclick="appen(6)">
<input type="button" value="<-" class='btn' onclick="trm()">
<br><br>
<input type="button" value="7" class='btn' onclick="appen(7)">
<input type="button" value="8" class='btn' onclick="appen(8)">
<input type="button" value="9" class='btn' onclick="appen(9)">
<input type="button" value="0" class='btn' onclick="appen(0)"><br><br>
<input type="button" value="+" class='btn' onclick="appen('+')">
<input type="button" value="-" class='btn' onclick="appen('-')">
<input type="button" value="X" class='btn' onclick="appen('*')">
<input type="button" value="=" class='btneq' onclick="eq()"><br><br>
<input type="button" value="OFF" class='btneq' onclick="clo()" style="margin-left: 100px;">
</form>
</div>
</div>
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
<script>
AOS.init();
function appen(n)
{
document.getElementById('inp').value+=n;
}
function cl()
{
document.getElementById('inp').value=0;
}
function eq()
{ a=document.getElementById('inp').value;
try{
document.getElementById('inp').value=eval(document.getElementById('inp').value);
}
catch(e){
document.getElementById('inp').value="ENTER VALID INPUT";
setTimeout(function(){ document.getElementById('inp').value=0; }, 900);
}
}
function trm()
{
str=document.getElementById('inp').value;
document.getElementById('inp').value= str.substring(0, str.length-1);
}
function clo()
{
document.getElementById('dataa').remove();
document.getElementById('calc').innerHTML += '<input type="button" value="ON" class="btneq" onclick="ins()" style="margin-left: 100px;">';
}
function ins()
{
str='<div class="bod" id="dataa"><form><input type="text" id="inp" disabled><br><br><input type="button" value="1" class="btn" onclick="appen(1)"><input type="button" value="2" class="btn" onclick="appen(2)"><input type="button" value="3" class="btn" onclick="appen(3)"><input type="button" value="C" class="btn" onclick="cl()"><br><br><input type="button" value="4" class="btn" onclick="appen(4)"><input type="button" value="5" class="btn" onclick="appen(5)"><input type="button" value="6" class="btn" onclick="appen(6)"><input type="button" value="<-" class="btn" onclick="trm()"><br><br><input type="button" value="7" class="btn" onclick="appen(7)"><input type="button" value="8" class="btn" onclick="appen(8)"><input type="button" value="9" class="btn" onclick="appen(9)"><input type="button" value="0" class="btn" onclick="appen(0)"><br><br><input type="button" value="+" class="btn" onclick="appen("+")"><input type="button" value="-" class="btn" onclick="appen("-")"><input type="button" value="X" class="btn" onclick="appen("*")"><input type="button" value="=" class="btneq" onclick="eq()"><br><br><input type="button" value="OFF" class="btneq" onclick="clo()" style="margin-left: 100px;"></form></div>';
document.getElementById('calc').innerHTML=str;
}
</script>
</body>
</html>