-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
373 lines (321 loc) · 12.4 KB
/
script.js
File metadata and controls
373 lines (321 loc) · 12.4 KB
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
var Puntuaciones = document.getElementById("Puntuaciones");
var puntuacionbtn1 = document.getElementById("puntuacionbtn1");
var puntuacionbtn2 = document.getElementById("puntuacionbtn2");
var enviar1 = document.getElementById("enviar1");
var enviar2 = document.getElementById("enviar2");
var enviar3 = document.getElementById("enviar3");
var enviar4 = document.getElementById("enviar4");
var enviar5 = document.getElementById("enviar5");
var siguiente1 = document.getElementById("siguiente1");
var siguiente2 = document.getElementById("siguiente2");
var siguiente3 = document.getElementById("siguiente3");
var siguiente4 = document.getElementById("siguiente4");
var siguiente5 = document.getElementById("siguiente5");
var pregunta1 = document.getElementById("pregunta1");
var pregunta2 = document.getElementById("pregunta2");
var pregunta3 = document.getElementById("pregunta3");
var pregunta4 = document.getElementById("pregunta4");
var pregunta5 = document.getElementById("pregunta5");
var modalExplicacion1 = document.getElementById("modalExplicacion1");
var modalExplicacion2 = document.getElementById("modalExplicacion2");
var modalExplicacion3 = document.getElementById("modalExplicacion3");
var modalExplicacion4 = document.getElementById("modalExplicacion4");
var modalExplicacion5 = document.getElementById("modalExplicacion5");
var respuestaCorrecta1 = document.getElementById("respuesta-correcta1");
var respuestaCorrecta2 = document.getElementById("respuesta-correcta2");
var respuestaCorrecta3 = document.getElementById("respuesta-correcta3");
var respuestaCorrecta4 = document.getElementById("respuesta-correcta4");
var respuestaCorrecta5 = document.getElementById("respuesta-correcta5");
var resp1 = document.getElementById("resp1");
var resp2 = document.getElementById("resp2");
var resp3 = document.getElementById("resp3");
var resp1_2 = document.getElementById("resp1_2");
var resp2_2 = document.getElementById("resp2_2");
var resp3_2 = document.getElementById("resp3_2");
var resp4_2 = document.getElementById("resp4_2");
var resp1_3 = document.getElementById("resp1_3");
var resp2_3 = document.getElementById("resp2_3");
var resp3_3 = document.getElementById("resp3_3");
var resp4_3 = document.getElementById("resp4_3");
var resp1_4 = document.getElementById("resp1_4");
var resp2_4 = document.getElementById("resp2_4");
var resp3_4 = document.getElementById("resp3_4");
var resp1_5 = document.getElementById("resp1_5");
var resp2_5 = document.getElementById("resp2_5");
var resp3_5 = document.getElementById("resp3_5");
var resp3_5 = document.getElementById("resp3_5");
var contador = 0;
var porcentaje = 0;
var pregLibre1 = document.getElementById("pregLibre1");
var respLibre1 = document.getElementById("respLibre1");
var enviarRespLibre1 = document.getElementById("enviarRespLibre1");
var classRespLibre1 = document.getElementById("classRespLibre1");
var modalExplicacion6 = document.getElementById("modalExplicacion6");
var siguiente6 = document.getElementById("siguiente6");
var Parte2PregLibre1 = document.getElementById("Parte2PregLibre1");
var Parte2PregLibre2 = document.getElementById("Parte2PregLibre2");
var TituloRespuestasAbiertas = document.getElementById("TituloRespuestasAbiertas");
var TituloMultipleChoise = document.getElementById("TituloMultipleChoise");
var VF1resp1 = document.getElementById("VF1resp1");
var VF1resp2 = document.getElementById("VF1resp2");
var correcto = document.getElementsByClassName("correcto");
var radio = document.getElementsByClassName("radio");
var Explicacion = document.getElementsByClassName("Explicacion");
var VFSiguiente1 = document.getElementById("VFSiguiente1");
var Preguntas = document.getElementById("Preguntas");
enviar1.onclick = function() {
modalExplicacion1.classList.remove("display-none");
siguiente1.classList.remove("display-none");
enviar1.disabled = true;
resp1.disabled = true;
resp2.disabled = true;
resp3.disabled = true;
respuestaCorrecta1.classList.add("respuesta-correcta");
if (resp3.checked) {
contador++;
}
}
siguiente1.onclick = function() {
pregunta2.classList.remove("display-none");
pregunta1.classList.add("display-none");
}
enviar2.onclick = function() {
modalExplicacion2.classList.remove("display-none");
siguiente2.classList.remove("display-none");
enviar2.disabled = true;
resp1_2.disabled = true;
resp2_2.disabled = true;
resp3_2.disabled = true;
resp4_2.disabled = true;
respuestaCorrecta2.classList.add("respuesta-correcta");
if (resp4_2.checked) {
contador++;
}
}
siguiente2.onclick = function() {
pregunta3.classList.remove("display-none");
pregunta2.classList.add("display-none");
}
enviar3.onclick = function() {
modalExplicacion3.classList.remove("display-none");
siguiente3.classList.remove("display-none");
enviar3.disabled = true;
resp1_3.disabled = true;
resp2_3.disabled = true;
resp3_3.disabled = true;
resp4_3.disabled = true;
respuestaCorrecta3.classList.add("respuesta-correcta");
if (resp1_3.checked) {
contador++;
}
}
siguiente3.onclick = function() {
pregunta4.classList.remove("display-none");
pregunta3.classList.add("display-none");
}
enviar4.onclick = function() {
modalExplicacion4.classList.remove("display-none");
siguiente4.classList.remove("display-none");
enviar4.disabled = true;
resp1_4.disabled = true;
resp2_4.disabled = true;
resp3_4.disabled = true;
respuestaCorrecta4.classList.add("respuesta-correcta");
if (resp2_4.checked) {
contador++;
}
}
siguiente4.onclick = function() {
pregunta5.classList.remove("display-none");
pregunta4.classList.add("display-none");
}
enviar5.onclick = function() {
modalExplicacion5.classList.remove("display-none");
siguiente5.classList.remove("display-none");
enviar5.disabled = true;
resp1_5.disabled = true;
resp2_5.disabled = true;
resp3_5.disabled = true;
respuestaCorrecta5.classList.add("respuesta-correcta");
if (resp2_5.checked) {
contador++;
}
}
siguiente5.onclick = function() {
Puntuaciones.classList.remove("display-none");
pregunta5.classList.add("display-none");
porcentaje = parseInt((contador * 100) / 5);
const PorcentajeAcertado = document.createElement("H3");
PorcentajeAcertado.innerHTML = "Usted acertó el " + porcentaje + " % ";
const Puntuacion = document.querySelector(".PuntuacionTexto1");
Puntuacion.appendChild(PorcentajeAcertado);
}
puntuacionbtn1.onclick = function() {
Puntuaciones.classList.add("display-none");
Parte2PregLibre1.classList.remove("display-none");
TituloRespuestasAbiertas.classList.remove("display-none");
TituloMultipleChoise.classList.add("display-none");
}
puntuacionbtn2.onclick = function() {
Puntuaciones.classList.add("display-none");
TituloRespuestasAbiertas.classList.remove("display-none");
Preguntas.classList.remove("display-none");
}
function habilitar() {
text1 = document.getElementById("text1").value;
text2 = document.getElementById("text2").value;
if (text1 == "") {
enviarRespLibre1.disabled = true;
} else {
enviarRespLibre1.disabled = false;
}
if (text2 == "") {
enviarRespLibre2.disabled = true;
} else {
enviarRespLibre2.disabled = false;
}
}
document.getElementById("text1").addEventListener("keyup", habilitar);
document.getElementById("text2").addEventListener("keyup", habilitar);
enviarRespLibre1.onclick = function() {
pregLibre1.classList.add("display-none");
respLibre1.classList.remove("display-none");
enviarRespLibre1.disabled = true;
siguiente6.classList.remove("display-none");
modalExplicacion6.classList.remove("display-none");
const texto = document.createElement("H3");
const texto2 = document.createElement("P")
texto.innerHTML = "Respuestas correctas:";
texto2.innerHTML = "Sangre <br> Secreciones vaginales <br> Semen <br> Leche materna";
const classRespLibre1 = document.querySelector(".classRespLibre1");
classRespLibre1.appendChild(texto);
classRespLibre1.appendChild(texto2);
}
siguiente6.onclick = function() {
siguiente6.classList.add("display-none");
Parte2PregLibre1.classList.add("display-none");
Parte2PregLibre2.classList.remove("display-none");
}
enviarRespLibre2.onclick = function() {
pregLibre2.classList.add("display-none");
respLibre2.classList.remove("display-none");
enviarRespLibre2.disabled = true;
siguiente7.classList.remove("display-none");
modalExplicacion7.classList.remove("display-none");
const texto = document.createElement("H3");
const texto2 = document.createElement("P");
texto.innerHTML = "Respuestas correctas:";
texto2.innerHTML = "Sexo sin protección con una persona con VIH <br> Uso de agujas infectadas o sin esterilizar para el consumo de drogas inyectables u otras sustancias. <br> Transmisión materno-infantil durante el embarazo, parto y la lactancia materna <br> Exposición a sangre infectada";
const classRespLibre2 = document.querySelector(".classRespLibre2");
classRespLibre2.appendChild(texto);
classRespLibre2.appendChild(texto2);
}
siguiente7.onclick = function() {
siguiente7.classList.add("display-none");
Parte2PregLibre2.classList.add("display-none");
Puntuaciones.classList.remove("display-none");
puntuacionbtn1.classList.add("display-none");
puntuacionbtn2.classList.remove("display-none");
Puntuacion2.classList.remove("display-none");
const RL = document.createElement("H3");
RL.innerHTML = "¡¡¡Respuestas Libres!!!";
const P2 = document.querySelector(".PuntuacionTexto2");
P2.appendChild(RL);
}
VFenviar.onclick = function() {
/* VFsiguiente.classList.remove("display-none");*/
VFenviar.disabled = true;
for (x = 0; x < radio.length; x++) {
radio[x].disabled = true;
}
for (x = 0; x < correcto.length; x++) {
correcto[x].classList.add("respuesta-correcta");
}
for (x = 0; x < Explicacion.length; x++) {
Explicacion[x].classList.remove("display-none");
}
VFSiguiente1.classList.remove("display-none");
}
var VF1resp2 = document.getElementById("1VFresp2");
var VF2resp2 = document.getElementById("2VFresp2");
var VF3resp2 = document.getElementById("3VFresp2");
var VF4resp1 = document.getElementById("4VFresp1");
var VF5resp1 = document.getElementById("5VFresp1");
var VF6resp2 = document.getElementById("6VFresp2");
var VF7resp2 = document.getElementById("7VFresp2");
var VF8resp2 = document.getElementById("8VFresp2");
var VF9resp1 = document.getElementById("9VFresp1");
var VF10resp1 = document.getElementById("10VFresp1");
var VF11resp2 = document.getElementById("11VFresp2");
var VF12resp2 = document.getElementById("12VFresp2");
var VF13resp1 = document.getElementById("13VFresp1");
var VF14resp2 = document.getElementById("14VFresp2");
var VF15resp2 = document.getElementById("15VFresp2");
var VF16resp2 = document.getElementById("16VFresp2");
var VF17resp2 = document.getElementById("17VFresp2");
var Inicio = document.getElementById("Inicio");
VFSiguiente1.onclick = function() {
Preguntas.classList.add("display-none");
Puntuaciones.classList.remove("display-none");
puntuacionbtn2.classList.add("display-none");
Inicio.classList.remove("display-none");
var porcentaje2 = 0;
var contador2 = 0;
if (VF1resp2.checked) {
contador2++;
}
if (VF2resp2.checked) {
contador2++;
}
if (VF3resp2.checked) {
contador2++;
}
if (VF4resp1.checked) {
contador2++;
}
if (VF5resp1.checked) {
contador2++;
}
if (VF6resp2.checked) {
contador2++;
}
if (VF7resp2.checked) {
contador2++;
}
if (VF8resp2.checked) {
contador2++;
}
if (VF9resp1.checked) {
contador2++;
}
if (VF10resp1.checked) {
contador2++;
}
if (VF11resp2.checked) {
contador2++;
}
if (VF12resp2.checked) {
contador2++;
}
if (VF13resp1.checked) {
contador2++;
}
if (VF14resp2.checked) {
contador2++;
}
if (VF15resp2.checked) {
contador2++;
}
if (VF16resp2.checked) {
contador2++;
}
if (VF17resp2.checked) {
contador2++;
}
porcentaje2 = parseInt((contador2 * 100) / 17);
Puntuacion3.classList.remove("display-none");
const VR = document.createElement("H3");
VR.innerHTML = "Usted acertó el " + porcentaje2 + " % ";
const P3 = document.querySelector(".PuntuacionTexto3");
P3.appendChild(VR);
}