Ver Mensaje Individual
  #18 (permalink)  
Antiguo 14/11/2008, 10:59
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Pulsar ENTER para boton

Por favor, usa un botón submit, es accesible, y haz las validaciones en el evento onsubmit del formulario. Pero bueno, es decisión tuya...

Además, lo de event.keyCode solo funciona en Internet Explorer.

Y por fin, lo que decía Mikmoro, aunque me suene descabellado :
Código html:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
  3. <title>Formulario</title>
  4. <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
  5. <script type="text/javascript">
  6. window.onload = function() { document.formclave.onsubmit = acceso; }
  7. function acceso(evt){
  8. if (evt) { evt.preventDefault(); } else { event.returnValue = false; }
  9. location.href = "http://" + document.formclave.clave.value;
  10. }
  11. <style type="text/css">
  12. .oculto {display: none;}
  13. </head>
  14. <form name="formclave">
  15. <input class="oculto"/>
  16. <input type="text" name="clave" />
  17. <input name="button" type="submit" value="Acceder" />
  18. </form>
  19. </body>
  20. </html>
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.