Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/02/2011, 11:56
Avatar de bUllan9ebrio
bUllan9ebrio
 
Fecha de Ingreso: enero-2011
Ubicación: Chile
Mensajes: 1.128
Antigüedad: 14 años, 1 mes
Puntos: 128
Respuesta: como evitar la ejecución de carácteres especiales, sin tener que eliminarl

tambien puedes probar con :

Código Javascript:
Ver original
  1. function isNumber(e) {   //SOLO NUMEROS
  2.     k = (document.all) ? e.keyCode : e.which;
  3.     if (k==8 || k==0) return true;
  4.     patron = /\d/;
  5.     n = String.fromCharCode(k);
  6.     return patron.test(n);
  7. }
  8. function validar(e) { // SOLO LETRAS
  9.     tecla = (document.all) ? e.keyCode : e.which;
  10.     if (tecla==8) return true;
  11.     patron =/[0-9kK\s]/;
  12.     te = String.fromCharCode(tecla);
  13.     return patron.test(te);
  14. }