Ya son miles, millones, miles de millones, las personas que se han enganchado a contestar las seis preguntas del Trivial Surf de la semana./* 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) ¿Owen Wright, es Goofy o Regular'?"; choices[0] = new Array(); choices[0][0] = "Goofy."; choices[0][1] = "Regular."; choices[0][2] = "Ninguno de los dos."; answers[0] = choices[0][0]; questions[1] = "2) ¿En que país se encuentra la ola de 'Boilers'?"; choices[1] = new Array(); choices[1][0] = "Suecia."; choices[1][1] = "Kenia."; choices[1][2] = "<a href="https://www.surf30.net/search/label/Nueva Zelanda" target="_blank" title="Nueva Zelanda">Nueva Zelanda</a>."; choices[1][3] = "Indonesia."; choices[1][4] = "Sudáfrica."; choices[1][5] = "Marruecos."; answers[1] = choices[1][5]; questions[2] = "3) ¿Cuántas veces ha ganado C.J. Hobgood el WCT?"; choices[2] = new Array(); choices[2][0] = "Ninguna vez."; 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) Las Olas de transpolación:"; choices[3] = new Array(); choices[3][0] = "Se presentan en la playa, la ola al tocar fondo avanza y se estrella en el litoral formando espuma."; choices[3][1] = "Se producen por el viento y en ocasiones pueden ser altas como consecuencia de los huracanes."; choices[3][2] = "Se representan en toda la superficie del mar y se deben a las variaciones del nivel del mar"; choices[3][3] = "Todas las anteriores."; choices[3][4] = "No existen."; answers[3] = choices[3][4]; questions[4] = "5) ¿Qué famoso surfista fue el protagonista de la película En Manos de Dios?"; choices[4] = new Array(); choices[4][0] = "Andy Irons."; choices[4][1] = "<a href="https://www.surf30.net/search/label/Kelly Slater" target="_blank" title="Kelly Slater">Kelly Slater</a>."; choices[4][2] = "<a href="https://www.surf30.net/search/label/Shane Dorian" target="_blank" title="Shane Dorian">Shane Dorian</a>."; choices[4][3] = "Taylor Knox."; choices[4][4] = "Tom Carrol."; choices[4][5] = "Ninguna de las anteriores."; answers[4] = choices[4][2]; questions[5] = "6) ¿Cómo perdió el ojo <a href="https://www.surf30.net/search/label/Jack O'Neill" target="_blank" title="Jack O'Neill">Jack O'Neill</a>?"; choices[5] = new Array(); choices[5][0] = "Accidente de moto."; choices[5][1] = "Cocinando."; choices[5][2] = "Surfeando."; choices[5][3] = "Esquiando."; choices[5][4] = "Todas las anteriores."; answers[5] = choices[5][2]; // 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."; 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<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 = ' <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.