Answer to Question #40275 in AJAX | JavaScript | HTML | PHP for Schneizel

Question #40275
Quick Quiz var answers = new Array();
answers[0] = "d";
answers[1] = "b";
answers[2] = "a";
answers[3] = "b";
answers[4] = "b";
answers[5] = "c";
answers[6] = "a";
answers[7] = "b";
answers[8] = "b";
answers[9] = "c";

var currentQues = 0;
var numQues = answers.length;
var numChoi = 4;

function getScore(form) {

var score = 0;
var currElt;
var currSelection;
for (i=0; i<numQues; i++) {
currElt = i*numChoi;
for (j=0; j<numChoi; j++) {
currSelection = form.elements[currElt + j];
if (currSelection.checked) {
if (currSelection.value == answers[i]) {
score++;
break; }
}
}
}

score = Math.round(score/numQues*100);
form.percentage.value = score;
return false;

}

function validate_form(theForm)
{
var radioSelected = false;
for (i = 0; i < theForm.q1.length; i++)
{
if (theForm.q1[i].checked)
radioSelected = true;
}
if (!radioSelected)
{
alert("Pls answer question No. 1");
return (false);
}

va
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS