Os dejo el test de la semana, creo que es el más facil de todos los que he realizado hasta el momento así que, a sacar nota.var questions = new Array(); var choices = new Array(); var answers = new Array(); var response = new Array(); // To add more questions, just follow the format below. questions[0] = "1) ¿En qué país está la playa de Esterillos?"; choices[0] = new Array(); choices[0][0] = "Panama."; choices[0][1] = "España."; choices[0][2] = "Honduras."; choices[0][3] = "Portugal."; choices[0][4] = "Costa Rica."; choices[0][5] = "EEUU."; answers[0] = choices[0][4]; questions[1] = "2) ¿Qué actor hacía de Bodhi en '<a href="https://www.surf30.net/search/label/Le llaman Bodhi" target="_blank" title="Le llaman Bodhi">Le llaman Bodhi</a>'?"; choices[1] = new Array(); choices[1][0] = "Keanu Reeves."; choices[1][1] = "<a href="https://www.surf30.net/search/label/Patrick Swayze" target="_blank" title="Patrick Swayze">Patrick Swayze</a>."; choices[1][2] = "Johnny Utah."; choices[1][3] = "John McGinley."; choices[1][4] = "Lori Petty."; choices[1][5] = "Ninguna de las anteriores."; answers[1] = choices[1][1]; questions[2] = "3) ¿Cuál de estos surfistas no ha ganado nunca el Pipeline Masters?"; choices[2] = new Array(); choices[2][0] = "Tom Curren."; choices[2][1] = "Tom Carrol."; choices[2][2] = "Derek Ho."; choices[2][3] = "Kelly Slater."; choices[2][4] = "Jake Paterson."; choices[2][5] = "Bruce Irons."; answers[2] = choices[2][0]; questions[3] = "4) ¿Qué es el periodo medio del oleaje? "; choices[3] = new Array(); choices[3][0] = "Es la mediana de los periodos de las tres olas más grandes"; choices[3][1] = "Es el cociente entre la altura de la ola."; choices[3][2] = "Es la suma de los ángulos de convexión referenciales."; choices[3][3] = "Es la media aritmetica de los periodos de todas las olas individuales."; choices[3][4] = "Ninguno de los anteriores."; answers[3] = choices[3][3]; questions[4] = "5) ¿El surf es un deporte reconocido por el Comité Olímpico Internacional?"; choices[4] = new Array(); choices[4][0] = "Si."; choices[4][1] = "No."; answers[4] = choices[4][0]; questions[5] = "6) ¿Cuál de estos surfistas ha ganado alguna vez una medalla olímpica?"; choices[5] = new Array(); choices[5][0] = "<a href="https://www.surf30.net/search/label/Joel Parkinson" target="_blank" title="Joel Parkinson">Joel Parkinson</a>."; choices[5][1] = "Coco Ho."; choices[5][2] = "<a href="https://www.surf30.net/search/label/Stephanie Gilmore" target="_blank" title="Stephanie Gilmore">Stephanie Gilmore</a>."; choices[5][3] = "Kelly Slater."; choices[5][4] = "Tom Curren."; choices[5][5] = "<a href="https://www.surf30.net/search/label/Duke Kahanamoku" target="_blank" title="Duke Kahanamoku">Duke Kahanamoku</a>."; answers[5] = choices[5][5]; // response for getting 100% response[0] = "¡Excelente, eres una máquina!"; // response for getting 90% or more response[1] = "Muy bien, intentalo otra vez para conseguir el 100%" // response for getting 70% or more response[2] = "¿Bien hecho, notable, lo puedes hacer mejor?"; // response for getting over 50% response[3] = "Aprobado, has respondido m&aacuete;s de la mitad de las preguntas correctamente."; // response for getting 40% or more response[4] = "Suspenso, te ha faltado poco para aprobar"; // response for getting 20% or more response[5] = "¡Mal, lo has hecho mal! "; // response for getting 10% or more response[6] = "¡My triste, me da que es imposible que pases el test por muchas veces que lo intentes!"; // response for getting 9% or less response[7] = "¡Vete a casa ya! Un mono ciego lo haría mejor que tu."; renderQuiz(); /* This script and many more are available free online at The JavaScript Source :: http://javascript.internet.com Created by: James Crooke :: http://www.cj-design.com */ var useranswers = new Array(); var answered = 0; function renderQuiz() { for(i=0;i<questions.length;i++) { document.writeln('<p class="question"><b>' + questions[i] + '<span id="result_' + i + '">'); for(j=0;j<choices[i].length;j++) { document.writeln('<input type="radio" name="answer_' + i + '" value="' + choices[i][j] + '" id="answer_' + i + '_' + j + '" class="question_' + i + '" onclick="submitAnswer(' + i + ', this, \'question_' + i + '\', \'label_' + i + '_' + j + '\')" /><label id="label_' + i + '_' + j + '" for="answer_' + i + '_' + j + '"> ' + choices[i][j] + '<br>'); } } document.writeln('<p><input type="submit" value="Ver la puntuación" onclick="showScore()" />   <input type="submit" value="Borrar el Test" onclick="resetQuiz(true)" />'); } function resetQuiz(showConfirm) { if(showConfirm) if(!confirm("Estas seguro de borrar las respuestas del test?")) return false; document.location = document.location; } function submitAnswer(questionId, obj, classId, labelId) { useranswers[questionId] = obj.value; document.getElementById(labelId).style.fontWeight = "bold"; disableQuestion(classId); showResult(questionId); answered++; } function showResult(questionId) { if(answers[questionId] == useranswers[questionId]) { document.getElementById('result_' + questionId).innerHTML = ' <i class="fa fa-check" style="color:green" aria-hidden="true"> '; } else { document.getElementById('result_' + questionId).innerHTML = ' <i class="fa fa-times" style="color:red">' + ' <b>La respuesta correcta es: ' + answers[questionId] + ''; } } function showScore() { if(answered != answers.length) { alert("Todavia no has respondido a todas las preguntas"); return false; } questionCount = answers.length; correct = 0; incorrect = 0; for(i=0;i<questionCount;i++) { if(useranswers[i] == answers[i]) correct++; else incorrect++; } pc = Math.round((correct / questionCount) * 100); alertMsg = "Has contestado bien " + correct + " preguntas de " + questionCount + "\n\n"; alertMsg += "Has contestado correctamente al " + pc + "% de las preguntas! \n\n"; if(pc == 100) alertMsg += response[0]; else if(pc >= 90) alertMsg += response[1]; else if(pc >= 70) alertMsg += response[2]; else if(pc >= 50) alertMsg += response[3]; else if(pc >= 40) alertMsg += response[4]; else if(pc >= 20) alertMsg += response[5]; else if(pc >= 10) alertMsg += response[6]; else alertMsg += response[7]; if(pc < 100) { if(confirm(alertMsg)) resetQuiz(false); else return false; } else { alert(alertMsg); } } function disableQuestion(classId) { var alltags=document.all? document.all : document.getElementsByTagName("*") for (i=0; i<alltags.length; i++) { if (alltags[i].className == classId) { alltags[i].disabled = true; } } }
No hay comentarios:
Anímate a participar en Surf 30, pero siempre con respeto.
Los comentarios reflejan solo las opiniones de los lectores.
Puedes consultar aquí la política de comenarios.