<th scope="row">&nbsp;&nbsp;&nbsp;&nbsp; 密码:<input id="txtUPwd" type="text" /></th>
          </tr>
          <tr>
            <th scope="row">
                <input id="Button1" type="button" value="登录" onclick="checkUser();" /></th>
就是执行Button1的事件
应该不难吧?

解决方案 »

  1.   

    <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp; 密码:<input id="txtUPwd" onblur="abortClick()" type="text" /></th>
              </tr>
              <tr>
                <th scope="row">
                    <input id="Button1" type="button" value="登录" onclick="checkUser();" /></th>
    js:
    function abortClick()
    {
    document.documentElementById("Button1").click();
    }
      

  2.   


    function tijiao(e)
    {
    var theEvent=windown.event||e;
    var code=theEvent.keyCode||theEvent.which;
    if(code==13)
    {
    document.getElementById("Button1").click();
    return false;
    }
    }
    <input id="txtUPwd" type="text" onkeydown="tijiao(event)" />
      

  3.   

    用jquery的话如下<html>
    <head>
    <script language="javascript" src="js/jquery-1.3.2.js"></script>
    <script language="javascript" type="text/javascript">
    $(document).ready(
    function()
    {
    $("#txt").keydown(
    function(e)
    {
    if(e.keyCode==13)
    {
    #("#btn").click();
    }
    }
    );
    }
    );
    </script>
    </head>
    <body>
    <input type="text" id="txt"></input>
    <input type="submit" id="btn" onclick="javascript:alert('执行Button');"
    </body>
    </html>jquery下载地址:http://jquery.com/