forked from Prankster1895/SlowSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
indextest.js
94 lines (69 loc) · 2.32 KB
/
indextest.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
83
84
85
86
87
88
89
90
91
92
93
94
let c=0,p=0;
document.addEventListener("DOMContentLoaded", function () {
if(document.getElementsByClassName("Correct")){
const btncount=document.getElementsByClassName("Correct")
const btncounter=Array.from(btncount);
btncounter.forEach((btncounter, index) => {
btncounter.addEventListener("click", () => {
// Check if the radio button has not been clicked before
if (!btncounter.disabled) {
// Increment the click count for this radio button
c++;
p++;
console.log(c,k,p)
// Disable the radio button to prevent further clicks
btncounter.disabled = true;
SubmitTest(c,k)
}
});
console.log("Hello");
});}
if(document.getElementsByClassName("CheckerW")){
const btncounti=document.getElementsByClassName("CheckerW")
const btncounteri=Array.from(btncounti);
btncounteri.forEach((btncounteri, index) => {
btncounteri.addEventListener("click", () => {
if (!btncounteri.disabled){
p++;
console.log(c,k,p);
btncounteri.disabled = true;
SubmitTest(c,k,p);
}
});
});
}
let k=0;
const btncountMod=document.getElementsByClassName("GCorrect")
const btncounterMod=Array.from(btncountMod);
btncounterMod.forEach((btncounter, index) => {
btncounter.addEventListener("click", () => {
// Check if the radio button has not been clicked before
if (!btncounter.disabled) {
// Increment the click count for this radio button
k++;
p++;
console.log(c,k,p)
// Disable the radio button to prevent further clicks
btncounter.disabled = true;
SubmitTest(c,k,p)
}
});
console.log("Hello");
});
function SubmitTest(c,k,p){
let Submit=document.getElementById("Test");
Submit.addEventListener("click", () => {
if(c<k && p==10){
console.log("Weak In Maths");
window.location.href="math.html";
}
if(k<c && p==10){
console.log("Weak In English");
window.location.href="english.html";
}
});
}
$('#modal-body').on('show.bs.modal', function (e) {
SubmitTest(c,k);
});
});