這個(gè)演示,在輸入時(shí),是不需要與服務(wù)端交互,只有全部輸入完畢之后,用戶點(diǎn)銨鈕才進(jìn)行驗(yàn)證。因此在這里,寫Javascript來(lái)實(shí)現(xiàn)即可。
script type="text/javascript">
function JumpToNextTextBox(currentTxtBox, nextTextBoxID) {
if (currentTxtBox.value.length >= 5) {
document.getElementById(nextTextBoxID).focus();
}
}
/script>
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>