MCPcopy Create free account
hub / github.com/codemistic/Web-Development / iterate

Function iterate

final quiz app/fquiz.js:85–171  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

83
84
85function iterate(id) {
86
87
88var result = document.getElementsByClassName("result");
89result[0].innerText = "";
90
91
92const question = document.getElementById("question");
93
94
95
96question.innerText = Questions[id].q;
97
98
99const op1 = document.getElementById('op1');
100const op2 = document.getElementById('op2');
101const op3 = document.getElementById('op3');
102const op4 = document.getElementById('op4');
103
104
105
106op1.innerText = Questions[id].a[0].text;
107op2.innerText = Questions[id].a[1].text;
108op3.innerText = Questions[id].a[2].text;
109op4.innerText = Questions[id].a[3].text;
110
111
112op1.value = Questions[id].a[0].isCorrect;
113op2.value = Questions[id].a[1].isCorrect;
114op3.value = Questions[id].a[2].isCorrect;
115op4.value = Questions[id].a[3].isCorrect;
116
117var selected = "";
118
119
120op1.addEventListener("click", () => {
121 op1.style.backgroundColor = "lightgoldenrodyellow";
122 op2.style.backgroundColor = "lightskyblue";
123 op3.style.backgroundColor = "lightskyblue";
124 op4.style.backgroundColor = "lightskyblue";
125 selected = op1.value;
126})
127
128
129op2.addEventListener("click", () => {
130 op1.style.backgroundColor = "lightskyblue";
131 op2.style.backgroundColor = "lightgoldenrodyellow";
132 op3.style.backgroundColor = "lightskyblue";
133 op4.style.backgroundColor = "lightskyblue";
134 selected = op2.value;
135})
136
137
138op3.addEventListener("click", () => {
139 op1.style.backgroundColor = "lightskyblue";
140 op2.style.backgroundColor = "lightskyblue";
141 op3.style.backgroundColor = "lightgoldenrodyellow";
142 op4.style.backgroundColor = "lightskyblue";

Callers 1

fquiz.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected