//默认按钮处理
function KeyDownHandler()
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified button
document.all['<%=button1.ClientID%>'].click();
}
}

解决方案 »

  1.   

    <SCRIPT LANGUAGE=javascript>
    <!--
     function document.onkeydown()
     {
    if(event.keyCode == 13)
    {
    document.all.button1.click();
    }
     }
    //-->
    </SCRIPT>
      

  2.   

    放在你的ASPX页面的HTML里面
    <SCRIPT LANGUAGE=javascript>function KeyDownHandler()
    {
    // process only the Enter key
    if (event.keyCode == 13)
    {
    // cancel the default submit
    event.returnValue=false;
    event.cancel = true;
    // submit the form by programmatically clicking the specified button
    document.all['<%=button1.ClientID%>'].click();
    }
    }
    </SCRIPT>2:button1.ClientIDClientID表示在客户端生成的唯一标志
    以便于用javascript来调用一个控件
      

  3.   

    if(event.keyCode == 13)
    document.all.button1.focus();
    document.all.button1.click();