function controllo() {
nome = document.modulo.nome.value;
cognome = document.modulo.cognome.value;
if (nome == '') {
alert("Il campo nome é obbligatorio");
document.modulo.nome.focus();
}
else if(cognome == '') {
alert("Ciao");
document.modulo.cognome.focus();
}
else {
document.modulo.action = "./control.php";
document.modulo.submit();
}
}
Ho richiamato la funzione con un button
<input type="button" value="invia" onclick="controllo();return true;">
Scrivevo else if tutto attaccato grazie per l'aiuto a tutti e due