<script language=javascript>
<!--
function document.onkeypress()
{
    if(event.keyCode == 13)}
//-->
</script>

解决方案 »

  1.   

    <script language=javascript>
    <!--
    function document.onkeypress()
    {
        if(event.keyCode == 13)
           document.all.Button1.click();
        else
           return false;
    }
    //-->
    </script>
    这样试试看,Button1为你要激发的登陆按钮
      

  2.   

    用这个控件试试,非常简单:http://www.metabuilders.com/Tools/DefaultButtons.aspx
      

  3.   

    function document.onkeypress()
    {
           if(event.keyCode==13) window.Form1.btt.click();
    }
      

  4.   


    function document.onkeypress()
    {
       if(event.keyCode==13)  document.all("button").focus();
    }
      

  5.   

    我试了,还是不行,这是我加入后的代码
    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="login.aspx.vb" Inherits="RTcrm.Login"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>login</title>
    <meta content="Microsoft Visual Studio .NET 7.0" name="GENERATOR">
    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0" name="vs_targetSchema">
    </HEAD>
    <script language=javascript>
    <!--
    function document.onkeypress()
    {
        if(event.keyCode == 13)
           document.all.Button1.click();
        else
           return false;
    }
    -->
    </script> <body onload="document.all.PassWord.focus()" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
    <FONT face="宋体"><FONT face="宋体">
    <FORM id="Form2" method="post" runat="server">
    <FONT face="宋体">
    <TABLE id="Table1" style="Z-INDEX: 101; LEFT: 2px; POSITION: absolute; TOP: 0px" height="100%" cellSpacing="1" cellPadding="1" width="100%" align="center" border="0">
    <TR>
    <TD align="middle" colSpan="1" borderColor="#c4d5d2">
    <TABLE id="Table2" style="WIDTH: 345px; HEIGHT: 35px" borderColor="#d8cedf" cellSpacing="1" cellPadding="1" width="345" border="0">
    <TR>
    <TD bgColor="#99ccff">
    <P align="center">公司内部信息管理系统</P>
    </TD>
    </TR>
    </TABLE>
    <TABLE id="Table5" style="WIDTH: 345px; HEIGHT: 95px" borderColor="#c2d1e2" cellSpacing="1" cellPadding="1" width="345" border="1">
    <TBODY>
    <TR>
    <TD width="121" height="30">
    <P align="center"><FONT size="2"> &nbsp;用户组:</FONT></P>
    </TD>
    <TD height="30">
    <asp:dropdownlist id="DropDownList1" runat="server" Width="156px" AutoPostBack="True"></asp:dropdownlist></TD>
    </TR>
    <TR>
    <TD width="121" height="32">
    <P align="center"><FONT size="2"><FONT size="2">&nbsp; 用户名<FONT size="2"><FONT size="2">:</FONT></FONT></FONT></FONT></P>
    </TD>
    <TD height="32"><FONT size="2">
    <asp:dropdownlist id="DropDownList2" runat="server" Width="156px"></asp:dropdownlist></FONT></TD>
    </TR>
    <TR>
    <TD width="121">
    <P align="center"><FONT size="2">密码:</FONT></P>
    </TD>
    <TD>
    <asp:textbox id="PassWord" runat="server" TextMode="Password" class="input"></asp:textbox></TD>
    </TR>
    </TD>
    </TR>
    </TABLE>
    <TABLE id="Table3" height="24" cellSpacing="1" cellPadding="1" width="345" align="center" border="1">
    <TR>
    <TD bgColor="#99ccff">
    <DIV align="center">
    <asp:button class="button" id="Button1" onclick="Click" runat="server" Width="47px" Text="登录" BackColor="LightSteelBlue"></asp:button></DIV>
    </TD>
    </TR>
    </TABLE>
    </FONT>
    </FORM>
    </FONT></FONT></TD></TR></TBODY></TABLE></FONT></FONT></FONT>
    </body>
    </HTML>