Today to do the project, the project is a car wash system, swipe after the focus out of the auto-trigger return event, such as, a text box, put the focus, brush the card, the text box automatically get card number, while triggering the return event, (just like a bank card), found after the page after the swipe of the button code, after the query , find two methods, method one: Change the text box to HTML control, plus Runat=server (server control does not onkeydown), plus
- <input type="text" id="T1" onkeydown="if (event.keycode==13) {document.getElementById (' BT ')." Click (); return false;} " /><button id="BT" onclick="alert (' Carriage return clicked button! ')" > Confirm </button> Executes the button event (button is a server control line)
- The second method is to continue the server control and write it in Pageload:
Txtcode.focus ();
TXTCODE.ATTRIBUTES.ADD ("onkeydown", "If" (Event.which | | Event.keycode) {if (Event.which = = 13) | | (Event.keycode = = 13)) {document.getElementById (' "+ Btnsearch.uniqueid +"). Click (); return false;}} else {return true}; ");
Questions about the Submit button after the HTML control and the server control press ENTER