ecco una versione funzionante:
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> <script type="text/javascript"> function modulo() { var nome = document.getElementById('nome'); if (nome.value=="Antonio") { alert("Hai inserito il nome giusto."); return true; } else { alert("Hai sbagliato."); nome.focus(); return false; } } </script> </head> <body> <form method="post" onsubmit="return modulo();"> <input type="text" name="nome" id="nome" /> <input type="submit" value="Invia" /> </form> </body> </html>

Rispondi quotando