Foros del Web » Programando para Internet » Javascript »

validacion de teclas?

Estas en el tema de validacion de teclas? en el foro de Javascript en Foros del Web. hola,este codigo lo utilizo,para ingresar solo letras y solo numeros en las cajas de texto,tambien me sirve la tecla de borrado. ¿Pero,como puedo conseguir que ...
  #1 (permalink)  
Antiguo 24/04/2006, 21:53
 
Fecha de Ingreso: febrero-2006
Mensajes: 446
Antigüedad: 18 años, 2 meses
Puntos: 3
validacion de teclas?

hola,este codigo lo utilizo,para ingresar solo letras y solo numeros en las
cajas de texto,tambien me sirve la tecla de borrado.

¿Pero,como puedo conseguir que me funcione la barra espaciadora del teclado?

este es el codigo que funciona bien,pero el problema que tengo es que no puedo ocupar la barra espaciadora.
gracias
Código:
<html>

<head>
  <title></title>

<script>
var nav4 = window.Event ? true : false;

function acceptNumNumero(evt)
{
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
var key = nav4 ? evt.which : evt.keyCode;
return ((key >= 48) && (key <= 57) || (key == 8)) ;
}


function acceptLetra(evt)
{
// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
var key = nav4 ? evt.which : evt.keyCode;
return ((key >= 65) && (key <= 90)||(key >= 97) && (key <= 122)
|| (key == 8));
}
</script>
</head>

<body>

<form name=formulario action=pagina.php method=post>
letra:<input type=text name=letra
onKeyPress="return acceptLetra(event)"><br>

numero:<input type=text name=numero
onKeyPress="return acceptNumNumero(event)"><br>
</form>
</body>

</html>
  #2 (permalink)  
Antiguo 24/04/2006, 23:33
 
Fecha de Ingreso: octubre-2004
Mensajes: 128
Antigüedad: 19 años, 6 meses
Puntos: 2
Código:
function(){


if(key==32) return true;

}
  #3 (permalink)  
Antiguo 25/04/2006, 15:52
 
Fecha de Ingreso: febrero-2006
Mensajes: 446
Antigüedad: 18 años, 2 meses
Puntos: 3
gracias
  #4 (permalink)  
Antiguo 08/08/2008, 10:06
 
Fecha de Ingreso: marzo-2005
Mensajes: 156
Antigüedad: 19 años, 1 mes
Puntos: 0
Respuesta: validacion de teclas?

hola.
Pero como puedo incluir a la tecla tab y shif
gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:30.