| 83 | |
| 84 | |
| 85 | function iterate(id) { |
| 86 | |
| 87 | |
| 88 | var result = document.getElementsByClassName("result"); |
| 89 | result[0].innerText = ""; |
| 90 | |
| 91 | |
| 92 | const question = document.getElementById("question"); |
| 93 | |
| 94 | |
| 95 | |
| 96 | question.innerText = Questions[id].q; |
| 97 | |
| 98 | |
| 99 | const op1 = document.getElementById('op1'); |
| 100 | const op2 = document.getElementById('op2'); |
| 101 | const op3 = document.getElementById('op3'); |
| 102 | const op4 = document.getElementById('op4'); |
| 103 | |
| 104 | |
| 105 | |
| 106 | op1.innerText = Questions[id].a[0].text; |
| 107 | op2.innerText = Questions[id].a[1].text; |
| 108 | op3.innerText = Questions[id].a[2].text; |
| 109 | op4.innerText = Questions[id].a[3].text; |
| 110 | |
| 111 | |
| 112 | op1.value = Questions[id].a[0].isCorrect; |
| 113 | op2.value = Questions[id].a[1].isCorrect; |
| 114 | op3.value = Questions[id].a[2].isCorrect; |
| 115 | op4.value = Questions[id].a[3].isCorrect; |
| 116 | |
| 117 | var selected = ""; |
| 118 | |
| 119 | |
| 120 | op1.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 | |
| 129 | op2.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 | |
| 138 | op3.addEventListener("click", () => { |
| 139 | op1.style.backgroundColor = "lightskyblue"; |
| 140 | op2.style.backgroundColor = "lightskyblue"; |
| 141 | op3.style.backgroundColor = "lightgoldenrodyellow"; |
| 142 | op4.style.backgroundColor = "lightskyblue"; |