Io ho questo script:
codice:
<html>
<head>
<title>Convalida dei dati numeri e lettere di un campo del form</title>
<script language="javascript">
function Convalida(){
if (!/[0-9]+/.test(document.test.pwd)){
alert("usa i numeri");
return false;}
return true;
}
</script>
</head>
<body>
<form name="test" action="convalidanumlett.asp" method="POST" onsubmit="return Convalida()">
<input type="text" name="pwd">
<input type="submit" value="Invia">
</form>
</body>
</html>
...che dovrebbe controllare che nel campo pwd del form siano inseriti solo numeri.
Però mi risponde sempre con la finestra alert.