-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
262 lines (240 loc) · 9.45 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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<title>Document</title>
</head>
<body>
<script>
var temp1 = false;
var temp2 = false;
function and_fn() {
const box = document.getElementById('and_div');
if (document.getElementById('ab1').checked) { temp1 = true; console.log("bt-1 and true"); }
else { temp1 = false; console.log("bt-1 and false"); }
if (document.getElementById('ab2').checked) { temp2 = true; console.log("bt-2 and true"); }
else { temp2 = false; console.log("bt-2 and false"); }
if (temp1 && temp2) {
box.style.backgroundColor = 'rgb(98, 246, 157)';
box.style.boxShadow = '0 8px 16px 0 rgba(159, 241, 140, 0.5)';
}
else {
box.style.backgroundColor = 'rgb(246, 98, 98)';
box.style.boxShadow = '0 8px 16px 0 rgba(241, 140, 140, 0.515)';
}
}
function or_fn() {
const box = document.getElementById('or_div');
if (document.getElementById('ob1').checked) { temp1 = true; console.log("bt-1 or true"); }
else { temp1 = false; console.log("bt-1 or false"); }
if (document.getElementById('ob2').checked) { temp2 = true; console.log("bt-2 or true"); }
else { temp2 = false; console.log("bt-2 or false"); }
if (temp1 || temp2) {
box.style.backgroundColor = 'rgb(98, 246, 157)';
box.style.boxShadow = '0 8px 16px 0 rgba(159, 241, 140, 0.5)';
}
else {
box.style.backgroundColor = 'rgb(246, 98, 98)';
box.style.boxShadow = '0 8px 16px 0 rgba(241, 140, 140, 0.515)';
}
}
function nand_fn() {
const box = document.getElementById('nand_div');
if (document.getElementById('nab1').checked) { temp1 = true; console.log("bt-1 nand true"); }
else { temp1 = false; console.log("bt-1 nand false"); }
if (document.getElementById('nab2').checked) { temp2 = true; console.log("bt-2 nand true"); }
else { temp2 = false; console.log("bt-2 nand false"); }
if (temp1 && temp2) {
box.style.backgroundColor = 'rgb(246, 98, 98)';
box.style.boxShadow = '0 8px 16px 0 rgba(241, 140, 140, 0.515)';
}
else {
box.style.backgroundColor = 'rgb(98, 246, 157)';
box.style.boxShadow = '0 8px 16px 0 rgba(159, 241, 140, 0.5)';
}
}
function nor_fn() {
const box = document.getElementById('nor_div');
if (document.getElementById('nob1').checked) { temp1 = true; console.log("bt-1 nor true"); }
else { temp1 = false; console.log("bt-1 nor false"); }
if (document.getElementById('nob2').checked) { temp2 = true; console.log("bt-2 nor true"); }
else { temp2 = false; console.log("bt-2 nor false"); }
if (temp1 || temp2) {
box.style.backgroundColor = 'rgb(246, 98, 98)';
box.style.boxShadow = '0 8px 16px 0 rgba(241, 140, 140, 0.515)';
}
else {
box.style.backgroundColor = 'rgb(98, 246, 157)';
box.style.boxShadow = '0 8px 16px 0 rgba(159, 241, 140, 0.5)';
}
}
function not_fn() {
const box = document.getElementById('not_div');
if (document.getElementById('otb1').checked) { temp1 = true; console.log("bt-1 not true"); }
else { temp1 = false; console.log("bt-1 not false"); }
if (temp1) {
box.style.backgroundColor = 'rgb(246, 98, 98)';
box.style.boxShadow = '0 8px 16px 0 rgba(241, 140, 140, 0.515)';
}
else {
box.style.backgroundColor = 'rgb(98, 246, 157)';
box.style.boxShadow = '0 8px 16px 0 rgba(159, 241, 140, 0.5)';
}
}
</script>
<style>
:root {
--blue: #1e90ff;
--white: #ffffff;
--red: rgb(246, 98, 98);
--green: rgb(98, 246, 157);
}
.colour_div {
height: 52px;
width: 80px;
border-radius: 5px;
margin-left: 3%;
box-shadow: 0 8px 16px 0 rgba(101, 101, 101, 0.3);
}
#and_div {
background-color: var(--red);
}
#or_div {
background-color: var(--red);
}
#nand_div {
background-color: var(--green);
}
#nor_div {
background-color: var(--green);
}
#not_div {
background-color: var(--green);
}
.card {
height: 150px;
transition: 0.3s;
background-color: #ffffff;
/* #F7F5F2 */
box-shadow: 0 8px 16px 0 rgba(101, 101, 101, 0.2);
width: 18%;
margin-right: 80px;
margin-left: 80px;
text-align: center;
border: 1px solid rgba(0, 0, 0, 0.124);
border-radius: 7px;
display: inline-block;
}
.mb {
display: flex;
margin-top: 10%;
justify-content: center;
}
.alc{
display: flex;
justify-content: center;
margin-top: 3%;
}
.tex{
margin-top: 9px;
}
</style>
<div class="alc">
<div class="card">
<div class="can">
<div class="tex">
AND
</div>
<div class="mb">
<div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="ab1" onclick="and_fn()">
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="ab2" onclick="and_fn()">
</div>
</div>
<div id="and_div" class="colour_div"></div>
</div>
</div>
</div>
<div class="card">
<div class="can">
<div class="tex">
OR
</div>
<div class="mb">
<div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="ob1" onclick="or_fn()">
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="ob2" onclick="or_fn()">
</div>
</div>
<div id="or_div" class="colour_div"></div>
</div>
</div>
</div>
</div>
<div class="alc">
<div class="card">
<div class="can">
<div class="tex">
NAND
</div>
<div class="mb">
<div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="nab1" onclick="nand_fn()">
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="nab2" onclick="nand_fn()">
</div>
</div>
<div id="nand_div" class="colour_div"></div>
</div>
</div>
</div>
<div class="card">
<div class="can">
<div class="tex">
NOR
</div>
<div class="mb">
<div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="nob1" onclick="nor_fn()">
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="nob2" onclick="nor_fn()">
</div>
</div>
<div id="nor_div" class="colour_div"></div>
</div>
</div>
</div>
</div>
<DIV class="alc">
<div class="card">
<div class="can">
<div class="tex">
NOT
</div>
<div class="mb">
<div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="otb1" onclick="not_fn()">
</div>
</div>
<div id="not_div" class="colour_div"></div>
</div>
</div>
</div>
</DIV>
</body>
</html>