-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask3.html
More file actions
170 lines (144 loc) · 3.48 KB
/
Copy pathtask3.html
File metadata and controls
170 lines (144 loc) · 3.48 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
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
<style type="text/css">
button{
padding: 10px;
border:2px solid black;
border-top:2px solid black;
background-color:black;
color:white;
border-radius: 8px;
height: 50px;
margin:10px;
width:60px;
text-align: center;
justify-content: center;
font-size: 18px;
font-weight: bold;
}
.buttons{
display: grid;
grid-template-rows: repeat(4,1);
grid-column: repeat(4,1);
padding: 10px;
text-align: center
border:0;
}
#screen1{
padding: 10px;
color:black;
background-color:#bccd95;
width:350px;
height:20px;
border:1px solid black;
font-size: 32px;
text-align: right;
}
.container{
border:1px solid transparent;
width:360px;
height: 380px;
background-color:#3d4543;
padding: 30px;
box-shadow: 0px 5px 20px rgba(0,0,0,0.3);
border-radius: 10px;
}
button:hover{
cursor: pointer;
}
.gray
{
text-decoration: none;
outline: none;
color:white;
font-color: white;
background-color: #6f6f6f;
border-bottom: black 2px solid;
border-top: 3px #6f6f6f solid;
}
.pink
{
color: white;
background-color: #ff4561;
border-bottom: black 2px solid;
}
.black
{
color: black;
background-color:white;
border-bottom: black 2px solid;
border-top: 2px 303030 solid;
font-weight: bold;
}
.orange
{
color: black;
background-color: white;
border-bottom: black 2px solid;
border-top: 2px FF9933 solid;
}
.gray{
border-top: 2px solid black;
outline: none;
text-decoration: none;
}
button:focus,button:active{
text-decoration: none;
outline: none;
}
.container:hover,.container:focus{
outline: none;
}
</style>
</head>
<body>
<center>
<header style="color: purple;font-size: 40px;padding: 20px"><b>Calculator</b></header>
<div class="container">
<div class="input" id="screen1"></div>
<div class="buttons">
<center>
<button class="gray" onclick='c("")'>mrc</button>
<button class="gray" onclick='c("")'>m-</button>
<button class="gray" onclick='c("")'>m+</button>
<button class="pink" onclick='display("/")'>÷</button>
<button class="black" onclick='display("7")'>7</button>
<button class="black" onclick='display("8")'>8</button>
<button class="black" onclick='display("9")'>9</button>
<button class="pink" onclick='display("*")'>×</button>
<button class="black" onclick='display("4")'>4</button>
<button class="black" onclick='display("5")'>5</button>
<button class="black" onclick='display("6")'>6</button>
<button class="pink" onclick="display('-')">-</button>
<button class="black" onclick="display('1')">1</button>
<button class="black" onclick="display('2')">2</button>
<button class="black" onclick="display('3')">3</button>
<button class="pink" onclick="display('+')">+</button>
<button class="black" onclick="display('0')">0</button>
<button class="black" onclick="display('.')">.</button>
<button class="black" onclick='c("")'>C</button>
<button class="orange" onclick='e()'>=</button>
</center>
</div>
</div>
</center>
<script type="text/javascript">
function c(val){
document.getElementById("screen1").innerHTML=val;
}
function display(val){
document.getElementById("screen1").innerHTML+=val;
}
function e(){
try{
c(eval(document.getElementById("screen1").innerHTML))
}
catch(e){
c("Error")
}
}
</script>
</body>
</html>