FALCONSEYE
Programmer
i am sorry, i guess it's friday and i am tired. here is my problem. i have a quiz that every answer has the following format
some question 1:
<input name="1" type="radio" value="a">1
<input name="1" type="radio" value="b">2
<input name="1" type="radio" value="c">3
<input name="1" type="radio" value="d">4
some question 2:
<input name="2" type="radio" value="a">1
<input name="2" type="radio" value="b">2
<input name="2" type="radio" value="c">3
<input name="2" type="radio" value="d">4
....
at the end, when the user clicks on submit, i want to check that every question is answered. there are 20 questions, and this is what i have so far
function checkAnswers() {
for (var i=1; i<21; i++)
{
if (document.quiz.toString(i).checked == false)
{
alert ("You must answer all of the questions!");
return false;
}
}
return true;
}
the above script doesn't return false even if i don't check any radio buttons. does anyone have an idea what goes on ?
thanks
some question 1:
<input name="1" type="radio" value="a">1
<input name="1" type="radio" value="b">2
<input name="1" type="radio" value="c">3
<input name="1" type="radio" value="d">4
some question 2:
<input name="2" type="radio" value="a">1
<input name="2" type="radio" value="b">2
<input name="2" type="radio" value="c">3
<input name="2" type="radio" value="d">4
....
at the end, when the user clicks on submit, i want to check that every question is answered. there are 20 questions, and this is what i have so far
function checkAnswers() {
for (var i=1; i<21; i++)
{
if (document.quiz.toString(i).checked == false)
{
alert ("You must answer all of the questions!");
return false;
}
}
return true;
}
the above script doesn't return false even if i don't check any radio buttons. does anyone have an idea what goes on ?
thanks