Vuelve el Test de la semana, con la única intención de pasar un buen rato. ¡Suerte!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 se encuentera la ola Pimentel?"; choices[0] = new Array(); choices[0][0] = "Portugal."; choices[0][1] = "España."; choices[0][2] = "Costa Rica."; choices[0][3] = "Perú."; answers[0] = choices[0][3]; questions[1] = "2) ¿Quién ganó el WCT de 1990?"; choices[1] = new Array(); choices[1][0] = "Tom Curren."; choices[1][1] = "Tom Carrol."; choices[1][2] = "<a href="https://www.surf30.net/search/label/Sunny Garcia" target="_blank" title="Sunny Garcia">Sunny Garcia</a>."; choices[1][3] = "Derek Ho."; choices[1][4] = "<a href="https://www.surf30.net/search/label/Kelly Slater" target="_blank" title="Kelly Slater">Kelly Slater</a>."; choices[1][5] = "Ninguna de las anteriores."; answers[1] = choices[1][0]; questions[2] = "3) ¿De qué está hecho básicamente el foam de una tabla de surf'?"; choices[2] = new Array(); choices[2][0] = "Cloruro de polivinilo."; choices[2][1] = "Espuma de carbohidrato."; choices[2][2] = "Poliuretano."; choices[2][3] = "Parafina."; answers[2] = choices[2][2]; questions[3] = "4) ¿Qué surfista no apareció en la película Morning of The Earth"; choices[3] = new Array(); choices[3][0] = "<a href="https://www.surf30.net/search/label/Gerry Lopez" target="_blank" title="Gerry Lopez">Gerry Lopez</a>."; choices[3][1] = "Wayne Lynch."; choices[3][2] = "Nat Young"; choices[3][3] = "<a href="https://www.surf30.net/search/label/Michael Peterson" target="_blank" title="Michael Peterson">Michael Peterson</a>."; answers[3] = choices[3][1]; questions[4] = "5) ¿En qué año se publicó por primera vez la revista Tres Sesenta?"; choices[4] = new Array(); choices[4][0] = "1971."; choices[4][1] = "1982."; choices[4][2] = "1987."; choices[4][3] = "1992."; answers[4] = choices[4][2]; questions[5] = "6) ¿Llegó <a href="https://www.surf30.net/search/label/Jack Johnson" target="_blank" title="Jack Johnson">Jack Johnson</a> a estar en el WCT?"; choices[5] = new Array(); choices[5][0] = "Si."; choices[5][1] = "No."; answers[5] = choices[5][1]; // 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á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] = "Muy 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."; var useranswers = new Array(); var answered = 0; function renderQuiz() { for(i=0;i<questions.length;i++) { document.writeln('<p class="question">' + questions[i] + ' <span id="result_' + i + '"><img style="max-width: 100%;border: 0;"src="http://img13.imageshack.us/img13/8100/blankw.gif" style="border:0" alt="" />'); 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)" /><p style="display:none"><img style="max-width: 100%;border: 0;"src="http://img12.imageshack.us/img12/8608/correct.gif" style="border:0" alt="¡Correcto!" /><img style="max-width: 100%;border: 0;"src="http://img11.imageshack.us/img11/5629/incorrect.gif" style="border:0" alt="¡Incorrecto!" /><br>'); } 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 = '<img style="max-width: 100%;border: 0;"src="http://img12.imageshack.us/img12/8608/correct.gif" style="border:0" alt="¡Correcto!" />'; } else { document.getElementById('result_' + questionId).innerHTML = '<img style="max-width: 100%;border: 0;"src="http://img11.imageshack.us/img11/5629/incorrect.gif" style="border:0" alt="¡Incorrecto!" />' + '<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; } } } renderQuiz();
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.