Questo codice funziona, l'unica pecca è che non capisce a quale domanda non è stata data risposta
codice:<html> <head> <script type="text/javascript"> var risposte = 2; function checkRisposte() { var ctrl = 0; var radio = document.getElementsByTagName("input"); for(i = 0; i < risposte; i ++){ if(radio[i].checked) ctrl++; } if(ctrl != risposte){ alert('Rispondi a tutte le domande'); return false; } return true; } </script> </head> <body> <form name="myForm" onsubmit="return checkRisposte()"> <input type="radio" name="r1" /> <input type="radio" name="r1" /> <input type="radio" name="r2" /> <input type="radio" name="r2" /> <input type="submit" value="Invia" /> </form> </body> </html>

Rispondi quotando