Ver Mensaje Individual
  #6 (permalink)  
Antiguo 10/05/2011, 14:15
angelfcm
(Desactivado)
 
Fecha de Ingreso: abril-2011
Mensajes: 153
Antigüedad: 13 años
Puntos: 236
Respuesta: 2 Textfield con 2 botones

Hola, te dejo un ejemplo:

Código HTML:
Ver original
  1. <title>Centrado</title>
  2. function presionarBtn(e,id){
  3.  var btn=document.getElementById(id);
  4.  n=e.which?e.which:e.keyCode;
  5.  if(n==13)
  6.   btn.click();
  7. }
  8. <style type="text/css">
  9. </head>
  10. <input type="text" onkeypress="presionarBtn(event,'btn1')" /><input type="button" id="btn1" value="botón 1" onclick="alert('botón 1 presionado')" />
  11. <input type="text" onkeypress="presionarBtn(event,'btn2')" /><input type="button" id="btn2"" value="bot&#243;n 2" onclick="alert('botón 2 presionado')" />
  12. </body>
  13. </html>
Saludos