Después de una semana de descanso vuelve el Trivial Surf de la semana con seis nuevas preguntas. ¿Serás capaz de superarlo?/* 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 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) ¿Qué famoso actor cómico aparecía en la película 'Fair Bits'?"; choices[0] = new Array(); choices[0][0] = "Adam Sandler."; choices[0][1] = "Ben Stiller."; choices[0][2] = "John Candy."; choices[0][3] = "Ninguno de los tres."; answers[0] = choices[0][1]; questions[1] = "2) ¿En que país se encuentra la ola de 'Playa Maderas'?"; choices[1] = new Array(); choices[1][0] = "Costa Rica."; choices[1][1] = "Perú."; choices[1][2] = "Honduras."; choices[1][3] = "Nicaragua."; choices[1][4] = "Mauritania."; choices[1][5] = "Marruecos."; answers[1] = choices[1][3]; questions[2] = "3) ¿Cuántas veces ha ganado <a href="https://www.surf30.net/search/label/Kelly Slater" target="_blank" title="Kelly Slater">Kelly Slater</a> el <a href="https://www.surf30.net/search/label/Billabong Pro Mundaka" target="_blank" title="Billabong Pro Mundaka">Billabong Pro Mundaka</a>?"; choices[2] = new Array(); choices[2][0] = "Ninguna."; choices[2][1] = "Una vez."; choices[2][2] = "Dos veces."; choices[2][3] = "Tres veces."; choices[2][4] = "Ninguna es la correcta."; answers[2] = choices[2][1]; questions[3] = "4) ¿Cuál es el máximo coeficiente de marea que se puede dar?"; choices[3] = new Array(); choices[3][0] = "100"; choices[3][1] = "10"; choices[3][2] = "118"; choices[3][3] = "120"; choices[3][4] = "Ninguna de las anteriores."; answers[3] = choices[3][3]; questions[4] = "5) ¿Quíen dijo 'Fuera del agua no soy nada'?"; choices[4] = new Array(); choices[4][0] = "Andy Irons."; choices[4][1] = "Kelly Slater."; choices[4][2] = "<a href="https://www.surf30.net/search/label/Laird Hamilton" target="_blank" title="Laird Hamilton">Laird Hamilton</a>."; choices[4][3] = "La sirenita."; choices[4][4] = "<a href="https://www.surf30.net/search/label/Duke Kahanamoku" target="_blank" title="Duke Kahanamoku">Duke Kahanamoku</a> ."; choices[4][5] = "Ninguna de las anteriores."; answers[4] = choices[4][4]; questions[5] = "6) ¿Dóde murió Mark Foo?"; choices[5] = new Array(); choices[5][0] = "Pipeline."; choices[5][1] = "Mavericks."; choices[5][2] = "Teahupoo."; choices[5][3] = "Indonesia."; choices[5][4] = "Ninguna de las anteriores."; 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 y borracho 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>Ver la puntuación   Ver la puntuación'); } 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"> ' + ' <font 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.