![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
25/05/2005, 12:32
|
![Avatar de JavierB](http://static.forosdelweb.com/customavatars/avatar16568_12.gif) | Colaborador | | Fecha de Ingreso: febrero-2002 Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años Puntos: 772 | |
Hola Maia.Bienvenida al foro.
Prueba este ejemplo:
Código:
<html>
<head>
<script>
function validar(e) {
tecla = (document.all) ? e.keyCode : e.which;
if (tecla==8) return true; //Tecla de retroceso (para poder borrar)
patron =/[\wáéíóúÁÉÍÓÚ]/;
te = String.fromCharCode(tecla);
return patron.test(te);
}
</script>
</head>
<body>
<input type="text" name="textfield" onkeypress="return validar(event)">
</body>
</html>
Saludos,
Última edición por JavierB; 25/05/2005 a las 12:48 |