Qui manca il ";" finale e il var iniziale, ma a parte questo, f non viene valorizzata. Presumo quindi che questa operazione non si possa fare.f = document.mioForm
Il codice che segue, almeno da me, funziona
Ciao!codice:<html> <head> <script language="javascript"> function controlla(formItem) { if (formItem.nome.value == "") { alert("il campo nome è obbligatorio"); return false; } return true; } </script> </head> <body> <form method="post" name="form2" id="form2" onsubmit="controlla(this)"> <input name="nome" type="text" id="nome" /> <input type="submit" value="vai"/> </form> <form method="post" name="form1" id="form1" onsubmit="controlla(this)"> <input name="nome" type="text" id="nome" /> <input type="submit" value="vai"/> </form> </body> </html>