The leader looked at the website developed by the Team and stressed that he must submit it by pressing enter automatically.
Find on the Internet:
<Script language = "JavaScript">
Function document. onkeydown ()
{
VaR E = event. srcelement;
If (event. keycode = 13)
{
Document. getelementbyid ("ID of the button to be clicked"). Click ();
}
}
</SCRIPT>
HoweverCodeFailed to implement what I want. Because there are multiple buttons on my page. The specified button is not able to be stimulated, but it is not what I want. I don't know why?
Being depressed, suddenly the thought of separating the button using <asp: Panel> came to mind, and the result was successful. Here we will share with you:
<Asp: imagebutton id = "getbackpwd" runat = "server" skinid = "getbackpwd" onlick = "getpwd"/>
<Asp: Panel id = "panlogin" runat = "server" defaultbutton = "login">
<Asp: textbox id = "txbusername" runat = "server"> </ASP: textbox>
<Asp: textbox id = "txbpwd" runat = "server" textmode = "password"> </ASP: textbox>
<Asp: imagebutton id = "login" runat = "server" skinid = "login" onclick = "login_click"/>
<Asp: imagebutton id = "register" runat = "server" skinid = "register" onclick = "Reg">
</ASP: Panel>
In this way, the carriage return only triggers the login_click event.
Because pane's defaultbutton = "login"