Per controllare se è un valore è numerico
ovviamente non testato. comunque l'idea c'è.codice:function isNum(unValore) { return isNaN(unValore) ? false : true; } function ctt(unTextField) { if (! isNum(unTextField.value)) { alert("Valore non numerico"); } aForm = unTextField.parentElement; aForm.submit(); } <form id="pippo" action="pippo.php" method="post"> <input type="text" id="t1"> <input type="button" value="clicca" onclick="ctt(document.getElementById('t1'))"> </form>

Rispondi quotando