Original Address: http://www.cnblogs.com/witer666/archive/2007/11/06/950845.html
Author: witer666
1. Press the Enter key does not submit data.
IF (== 13 is window.event.keyCode)
{
event.returnValue = to false;
Event.CANCEL = to true;
}
2. Press the Enter key to trigger an event in the File box
TextBox1 .Attributes.Add ( "onkeydown", "IF (event.which || event.keyCode) {IF ((event.which == 13) || (Event == 13 is .keyCode)) {document.getElementById ( ' "+ Button1 .UniqueID +"') the Click ();. return to false; the else {}}} return to true; ");
3.ASP.NET2.0 page opens in setting a default button focus
<form defaultButton = "Button1" the runat = "Server">
<ASP: TextBox ID = "TextBox1" the runat = "Server" />
<ASP: TextBox ID = "TextBox2" the runat = "Server" / >
<ASP: Button ID = "Button1" text = "Button1" the runat = "Server" />
<ASP: Panel defaultButton = "Button2" the runat = "Server">
<ASP:textbox id="textbox3" runat="server"/>
<asp:button id="button2" runat="server"/>
</asp:panel>
</form>
Trackback:http://www.beansoftware.com/ASP.NET-Tutorials/Accept-Enter-Key.aspx
Reproduced in: https: //www.cnblogs.com/iksharp/archive/2009/03/19/1416741.html