In javascript, input is automatically set to focus, and criptinput
Copy codeThe Code is as follows:
<Html>
<Head>
<Script type = "text/javascript">
Function moveNext (object, index ){
If (object. value. length = 4 ){
Document. forms [0]. elements [index + 1]. focus ();
}
}
Function showResult (){
Var f = document. forms [0];
Var result = "";
For (var I = 0; I <4; I ++ ){
Result + = f. elements [I]. value;
}
Alert (result );
}
</Script>
</Head>
<Body onload = "document. forms [0]. elements [0]. focus ();">
<Form>
<Input type = "text" size = "3" maxlength = "4" onkeyup = "moveNext (this, 0);">
<Input type = "text" size = "3" maxlength = "4" onkeyup = "moveNext (this, 1);">
<Input type = "text" size = "3" maxlength = "4" onkeyup = "moveNext (this, 2);">
<Input type = "text" size = "3" maxlength = "4" onkeyup = "moveNext (this, 3);">
<Input type = "button" value = "display" onclick = "showResult ();">
</Form>
</Body>
</Html>
The code is very simple, and the function is very practical. You can use it in your own project if your friends beautify it. Isn't it cool?