InASP. NETIf multiple text boxes exist on the same page, press "enter" in each text box to return the first one by default.ButtonOfClickEvents, how can I press the Enter key without causing unexpected responses, or how to press the Enter key in different places to get different responses,This problem has plagued me for a long time and has not yet been completely solved. I will share my current discussions with you for a better understanding.
1. No response is triggered when you press the Enter key anywhere on the page.
If you do not need to set carriage return for submission on the entire page, you can convert the carriage return function of the entire pageTabTo add the following content to the file header:Code:
<Script language = "JavaScript" event = "onkeydown" for = "document">
If (event. keycode = 13)
Event. keycode = 9;
</SCRIPT>
2. Press enter in different places to get different responses
If the same page has multiple text boxes (Textbox), Each text box corresponds to a different submit button (Button)For example, on the following "login" page, there are two text boxes: "Enter mailbox number" and "enter account number" and"Enter email" and "EnterCommunity.
Expected results:
1. Enter the mailbox number and press enter to respond to the event of the "Enter mailbox" button. For simplicity, the "Enter mailbox" button will display the "Mailbox: * *** "(The *** is the entered mailbox number), as shown in:
2. Enter the account and press enter to respond to the event of the "Enter community" button. For simplicity, the "Enter community" button will display the "Community" in the "information display" text box: * *** "(The *** is the entered community account), as shown in:
The implementation steps are as follows: