var userInput = new Array();
var answers = new Array(10);
answers[0] = "B";
answers[1] = "C";
answers[2] = "A";
answers[3] = "C";
answers[4] = "D";
answers[5] = "D";
answers[6] = "D";
answers[7] = "D";
answers[8] = "C";
answers[9] = "A";
function getScore(){
var score=0;
var numQuestions=10;
for (var i=0;iView
Results
function returnScore(){ alert("Your score is "+ getScore() +"/"+
tot);
}
How many letters are there in "JS"?
2
1
3
4
How many letters are there in "BMX"?
2
1
3
4
How many letters are there in "A"?
2
1
3
4
var question0s =
document.getElementsByName("question0");
for (var i = 0; i < question0s.length; i++) { if
(question0s[i].checked) { userInput[0] = question0s[i].value; }
}
userInput[0] =
document.querySelector('input[name="question0"]:checked').value;
function getScore(){ for (var i = 0; i < answers.length; i++)
{ var currentQuestion = "question" + i; var questionAnswers =
document.getElementsByName(currentQuestion); for (var j = 0; j
< questionResponses.length; j++) { if
(questionResponses[i].checked) { userInput[i] =
question0s[i].value; } } } // after this completes, you'll have
the user input values // the rest of your code should now work
for (var i=0;iQuiz Questions And Answers
Quiz Questions
Today, there have been 39744 visitors (78498 hits) on this page!