Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/06/2009, 17:54
American2010
 
Fecha de Ingreso: abril-2003
Mensajes: 1.129
Antigüedad: 21 años, 11 meses
Puntos: 34
[Duda] Permitir TAB en un "input"

Tengo este código que se supone que limita que tipo de teclas se pueden precionar en un input, sin embargo, si bien limita que no se ingresen caracteres raros y otras cosas... No logro que permita el presionar TAB

Código HTML:
function validar(e) {
    tecla = (document.all) ? e.keyCode : e.which;
    if (tecla==8) return true;
    if (tecla==95) return true;
    if (tecla==9) return true;
    if (tecla==37) return true;
    if (tecla==38) return true;
    if (tecla==39) return true;
    if (tecla==40) return true;
    if (tecla==127) return true;
	patron =/[A-Za-z\d\s]/;
    te = String.fromCharCode(tecla);
    return patron.test(te);
}
En el input lo llamo así...

Código HTML:
<input type="text" onkeypress="return validar(event)" name="F1" size="30" maxlength="20" tabindex="1" value=""> 
De todos esos if sólo me reconoce el 8 que habilita el Backspace
__________________
elGastronomo