Tema: Numeros
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 27/11/2002, 09:04
Avatar de TomaHawkk
TomaHawkk
 
Fecha de Ingreso: diciembre-2001
Ubicación: España
Mensajes: 422
Antigüedad: 23 años, 5 meses
Puntos: 1
Hola,

para comprobar en cliente podrias utilizar esto:

Cita:
<head>

<script language="JavaScript">
<!--
var nav4 = window.Event ? true : false;
function acceptNum(evt){
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 13 || (key >= 48 && key <= 57));
}
//-->
</script>

</head>
<body>
Prueba a introducir caracteres en la caja de texto. Solo te dejará numeros!<br>
<p><input type="text" name="valor" size="12" maxlength="12"
onKeyPress="return acceptNum(event)"></p>

</body>
Saludos.