Move cursor on next control on complete filled

Move cursor on next control on complete filled

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function ChangeControl(CurrentControl, NextControl) {
            debugger;
            if (CurrentControl.value.length >= CurrentControl.maxLength) {
                document.getElementById(NextControl).focus();
            }
        }
    </script>
    <style type="text/css">
        .txtwidth
        {
            width: 40px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Please Enter Card Number :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txt1" runat="server" MaxLength="4" onkeyup="ChangeControl(this, 'txt2')"
            ClientIDMode="Static" CssClass="txtwidth"></asp:TextBox>&nbsp;
        <asp:TextBox ID="txt2" runat="server" MaxLength="4" onkeyup="ChangeControl(this, 'txt3')"
            CssClass="txtwidth"></asp:TextBox>&nbsp;
        <asp:TextBox ID="txt3" runat="server" MaxLength="4" onkeyup="ChangeControl(this, 'txt4')"
            CssClass="txtwidth"></asp:TextBox>&nbsp;
        <asp:TextBox ID="txt4" runat="server" MaxLength="4" CssClass="txtwidth" onkeyup="ChangeControl(this, 'txt5')"></asp:TextBox>
        <br />
        <br />
        Please Confirm Card Number :
        <asp:TextBox ID="txt5" runat="server" MaxLength="4" onkeyup="ChangeControl(this, 'txt6')"
            ClientIDMode="Static" CssClass="txtwidth"></asp:TextBox>&nbsp;
        <asp:TextBox ID="txt6" runat="server" MaxLength="4" onkeyup="ChangeControl(this, 'txt7')"
            CssClass="txtwidth"></asp:TextBox>&nbsp;
        <asp:TextBox ID="txt7" runat="server" MaxLength="4" onkeyup="ChangeControl(this, 'txt8')"
            CssClass="txtwidth"></asp:TextBox>&nbsp;
        <asp:TextBox ID="txt8" runat="server" MaxLength="4" CssClass="txtwidth"></asp:TextBox>
    </div>
    </form>
</body>
</html>


It will look like :-



Comments

Popular posts from this blog

Create and save QR code in asp.net with C#

Change text of RadGrid Header Dynamically

Telerik Radwindow Open on Button Click