[Javascript_source] 텍스트박스 자동 포커스
2016. 5. 27. 11:01ㆍSource/Javascript_source
728x90
how to move focus on next field when maxlength
해당 텍스트박스의 MaxLength에 도달하면 다음 텍스트박스에 포커스
1 2 3 4 5 6 7 8 9 | function AutoFocus(thisTextBox, NextTextBox) { var Length = thisTextBox.value.length; var maxLength = thisTextBox.getAttribute( "maxLength"); if (Length == maxLength) { document.getElementById(NextTextBox).focus(); } } | cs |
1 2 3 4 5 6 7 8 9 10 | <asp: TextBox runat ="server" ID ="txt01" Style ="ime-mode: disabled; text-align:center;" Width="40" Text="134" MaxLength="3" CssClass="textbox" TabIndex="2" onkeyup="AutoFocus(this,'txt02')" ></asp: TextBox> <asp: TextBox runat ="server" ID ="txt02" Style ="ime-mode: disabled; text-align:center;" Width="40" Text="134" MaxLength="3" CssClass="textbox" TabIndex="2" ></asp: TextBox> | cs |
728x90