Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/11/2010, 14:11
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 11 meses
Puntos: 310
Respuesta: ayuda, problema para escribir en un campo

Por cierto, se podría optimizar la función para no tener que escribirla 5 veces. Mira a ver así:
Código Javascript:
Ver original
  1. function teclado(e, regexp) {
  2. tecla = (document.all) ? e.keyCode : e.which;
  3. if (tecla==8) return true;
  4. patron =new regExp(regexp);
  5. te = String.fromCharCode(tecla);
  6. return patron.test(te);
  7. }
Y luego la llamas así:
Código Javascript:
Ver original
  1. teclado(event, '\d');
  2. teclado(event, '[A-zñÑ\s]');
  3. // ...
Saludos (:
__________________
" Getting older’s not been on my plans
but it’s never late, it’s never late enough for me to stay. "
Cigarettes - Russian Red