![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
25/01/2010, 08:40
|
![Avatar de ceSharp](http://static.forosdelweb.com/customavatars/avatar269155_2.gif) | | | Fecha de Ingreso: octubre-2008 Ubicación: Madrid
Mensajes: 495
Antigüedad: 16 años, 3 meses Puntos: 66 | |
Respuesta: probelmas con acceptNum hola algadar,
he probado esa función que pones y no funciona muy bien que digamos... si quieres cópiate esta, que es la típica de expresiones regulares y tal...
--------------------------------------
function acceptNum(e)
{
var tecla;
tecla = (document.all) ? e.keyCode : e.which;
if(tecla == 8)
{return true;}
var patron;
//patron = /[abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUV WXYZ0123456789]/
patron = /\d/; //solo acepta numeros
var te;
te = String.fromCharCode(tecla);
return patron.test(te);
}
---------------------------------
para hacerla funcionar recuerda que usamos el evento onkeypress="return acceptNum(event)"
salu2 |