继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

ASP.NET实现License Key输入功能

ajax快速入门培训基础
关注TA
已关注
手记 284
粉丝 176
获赞 719

当我们安装微软的软件,多数软件是需要输入license key。它有五个文本框,输入完第一个文本框之后,光标自动跳至下一个文本框。
Insus.NET今天也使用asp.net来模仿一个。呵呵。

这个演示,在输入时,是不需要与服务端交互,只有全部输入完毕之后,用户点铵钮才进行验证。因此在这里,写Javascript来实现即可。

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>

 

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP