/ Published in: JavaScript

Simular submit al hacer enter y tener un boton type="button"
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> function login() { // funcion } function chequearEnter(event) { if (event.keyCode == 13) { login(); } } </script> <table width="400px" align="center"> <tr><td colspan="2"></td></tr> <tr> <td>Usuario</td> <td><input type="text" name="txtNombre" id="txtNombre" onkeypress="chequearEnter(event)"></td> </tr> <tr> <td>Clave</td> <td><input type="password" name="txtClave" id="txtClave" onkeypress="chequearEnter(event)"></td> </tr> <tr><td colspan="2"></td></tr> <tr> <td colspan="2" align="center"><input type="button" value="Entrar" onclick="login()"></td> </tr> </table>
Comments
