Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/04/2006, 21:53
-thor-
 
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>