/ Published in: JavaScript
extraido de http://www.bloglines.com/myblogs
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } </script> HTML: <form action="http://www.google.es"> Nombre: <input onkeypress="return handleEnter(this, event)" name="nombre"> <br> Apellidos: <input onkeypress="return handleEnter(this, event)" name="apellidos"> <br> Email: <input onkeypress="return handleEnter(this, event)" name="email"> <br> Comentarios: <textarea rows=6 cols=40>