ASP.NET实现License Key输入功能的小例子
这个演示,在输入时,是不需要与服务端交互,只有全部输入完毕之后,用户点铵钮才进行验证。因此在这里,写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 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>
上一篇: java基于反射得到对象属性值的方法
下一篇: 详解django中自定义标签和过滤器