Voglio creare una piccola domanda a scelta multipla, questo è il mio codice:
codice:
<html>
<head>
<script type="text/javascript">
function prova()
{
if (ubuntu.scelta[0].checked)
{
alert("Sbagliato");
}
else if (ubuntu.scelta[1].checked)
{
alert("Sbagliato");
}
else if (ubuntu.scelta[2].checked)
{
alert=("Giusto");
}
else if (ubuntu.scelta[3].checked)
alert=("Sbagliato");
}
}
</script>
</head>
<body>
<form method="get" onSubmit="prova()" name="ubuntu">
<input type="radio" value="Ok" name="scelta" />Karmic Koala
<input type="radio" value="Ok" name="scelta" />Natty Narwhal
<input type="radio" value="Ok" name="scelta" />Oneiric Ocelot
<input type="radio" value="Ok" name="scelta" />Warty Warthog
<input type="submit" value="Verifica"/>
</form>
</body>
</html>
I primi due alert dopo averi selezionati si verificano, ma il terzo ed il quarto no..perchè??
Grazie a tutti