E' onclick, non onsubmit.
Ti faccio un esempio di codice che uso e funziona correttamente
Codice PHP:/************************ parte JS **********************/
function checkForm() {
var form = document.getElementById("reg");
// verifica che i campi del form di registrazione non siano vuoti
if((form.nome.value == "") || (form.nome.value == "undefined")) {
avvisi.innerHTML = "Inserire il proprio nome";
form.nome.focus();
return false;
}
//altri controlli
return true;
}
/******************************************************/
/******************* parte html **************************/
<form id="reg" method="post" action="../utils/invio_reg.php">
<table border="0">
<tr>
<td>Nome:</td>
<td colspan="2"><input type="text" name="nome" /></td>
</tr>
//altri campi
<tr>
<td><input type="submit" name="invia" value="Registrati" onclick="checkForm()" /></td>
</tr>
</table>
</form>
/******************************************************/

Rispondi quotando
