scopiazzando qua e là ho fatto questo
codice:
function check_quiz (pnum){
var str = "Attenzione non hai selezionato la risposta alla domanda nr. ";
var domanda = "";
for (var i = 1; i <= pnum; i++)
{
domanda = document.quiz.elements[i];
if ((!domanda[0].checked) && (!domanda[1].checked) && (!domanda[2].checked) && (!domanda[3].checked) && (!domanda[4].checked))
{
alert(str + i);
domanda[0].focus();
return false;
}
}
return true;
}
ma mi dà errore e mi dice
domanda[0] is undefined
che cosa sbaglio?
il form lo inizializzo così
codice:
<form action="send.php" method="post" name="quiz" onSubmit="return check_quiz(40)">
e dentro ci sono tutti i radio button
codice:
<h4>Genere</h4>
<input type="radio" name="1" value="M"/>M
<input type="radio" name="1" value="F"/>F
Suggestions?