ASP. NET implements the License Key input function, asp. netlicense
When we install Microsoft software, most of the software requires entering the license key. It has five text boxes. after entering the first text box, the cursor automatically jumps to the next text box.
Insus. NET today also uses asp.net to imitate one. Haha.
In this demonstration, you do not need to interact with the server during input. You can click the button only after all input is complete. Therefore, you can simply write Javascript here.
View Code
<script type="text/javascript"> function JumpToNextTextBox(currentTxtBox, nextTextBoxID) { if (currentTxtBox.value.length >= 5) { document.getElementById(nextTextBoxID).focus(); } } </script>
Html code:
View Code
License Key: <asp:TextBox ID="Number1" runat="server" onkeyup="JumpToNextTextBox(this, 'Number2')" Width="65"></asp:TextBox> - <asp:TextBox ID="Number2" runat="server" onkeyup="JumpToNextTextBox(this, 'Number3')" Width="65"></asp:TextBox> - <asp:TextBox ID="Number3" runat="server" onkeyup="JumpToNextTextBox(this, 'Number4')" Width="65"></asp:TextBox> - <asp:TextBox ID="Number4" runat="server" onkeyup="JumpToNextTextBox(this, 'Number5')" Width="65"></asp:TextBox> - <asp:TextBox ID="Number5" runat="server" MaxLength ="5" Width="65"></asp:TextBox>