-
Notifications
You must be signed in to change notification settings - Fork 0
/
table_script.js
34 lines (30 loc) · 946 Bytes
/
table_script.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
function submit()
{
const checkboxes = document.querySelectorAll(`input[name="item"]:checked`);
let values = [];
checkboxes.forEach((checkbox) =>
{
values.push(checkbox.value);
if(checkbox.value=="toothbrush" || checkbox.value=="whisk" || checkbox.value=="fish")
{
document.getElementById("alert1").style.display="block";
}
});
var correct = ["calculator","pcase","sandwich","notebook","hsan"];
var success = true;
var i;
for (i=0; i < 4; i++){
if (values[i] != correct[i]){
success = false;
}
}
if (success == true && values.length == 5){
document.getElementById("success").style.display="block";
setTimeout(function(){
window.location.replace("bus.html");
}, 2000);
}
else{
document.getElementById("alert2").style.display="block";
}
}