http://javascript.internet.com/miscellaneous/multi-quiz.zip
/* 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[i] + ' 
for(j=0;j
');
}
}
document.writeln('
');
}
function resetQuiz(showConfirm) {
if(showConfirm)
if(!confirm("Are you sure you want to reset your answers and start from the beginning?"))
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 = '
';} else {
document.getElementById('result_' + questionId).innerHTML = '
';}
}
function showScore() {
if(answered != answers.length) {
alert("You have not answered all of the questions yet!");
return false;
}
questionCount = answers.length;
correct = 0;
incorrect = 0;
for(i=0;i
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 < alltags="document.all?" i="0;" if="" classname="=" disabled="true;">
/* 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) What is the picture shown above";
choices[0] = new Array();
choices[0][0] = "Horse";
choices[0][1] = "Lion";
choices[0][2] = "Squirrel";
choices[0][3] = "Monkey";
answers[0] = choices[0][1];
// response for getting 100%
response[0] = "Now, here's the link to the next clue!";
// response for getting 90% or more
response[1] = "Excellent, try again to get 100%!"
// response for getting 70% or more
response[2] = "Well done, that is a good score, can you do better?";
// response for getting over 50%
response[3] = "Nice one, you got more than half of the questions right, can you do better?";
// response for getting 40% or more
response[4] = "You got some questions right, you can do better!";
// response for getting 20% or more
response[5] = "You didn't do too well, why not try again!?";
// response for getting 10% or more
response[6] = "That was pretty poor! Try again to improve!";
// response for getting 9% or less
response[7] = "Oh dear, I think you need to go back to school (or try again)!";




1 comment:
Good Day,
I,ve search for those who read RICHDAD books, I saw that you already did and I Thank you for that.
I would like invite you to read some of my posts about my current views..
Thank you.
Post a Comment