这个演示,在输入时,是不需要与服务端交互,只有全部输入完毕之后,用户点铵钮才进行验证。因此在这里,写Javascript来实现即可。
js:
复制代码 代码如下:
<script type="text/javascript">
function JumpToNextTextBox(currentTxtBox, nextTextBoxID) {
if (currentTxtBox.value.length >= 5) {
document.getElementById(nextTextBoxID).focus();
}
}
</script>
Html code:
复制代码 代码如下:
License Key:
<asp:TextBox runat="server" onkeyup="JumpToNextTextBox(this, 'Number2')"></asp:TextBox>
-
<asp:TextBox runat="server" onkeyup="JumpToNextTextBox(this, 'Number3')"></asp:TextBox>
-
<asp:TextBox runat="server" onkeyup="JumpToNextTextBox(this, 'Number4')"></asp:TextBox>
-
<asp:TextBox runat="server" onkeyup="JumpToNextTextBox(this, 'Number5')"></asp:TextBox>
-
<asp:TextBox runat="server" MaxLength ="5"></asp:TextBox>
新闻热点
疑难解答
图片精选