html部分:
<input id="inpo1" type="text" maxlength="4" name="inp1" onkeyup="return inp1_onkeyup()">
<input id="inpo2" type="text" maxlength="4" name="inp2" onkeyup="return inp2_onkeyup()">
<input id="inpo3" type="text" maxlength="4" name="inp3" onkeyup="return inp3_onkeyup()">
<input id="inpo4" type="text" maxlength="4" name="inp4" onkeyup="return inp4_onkeyup()">
js部分:
function inp1_onkeyup(){
if(document.getElementById('inpo1').value.length==4){
document.getElementById('inpo2').focus()
}
}
function inp2_onkeyup(){
if(document.getElementById('inpo2').value.length==4){
document.getElementById('inpo3').focus()
}
}
function inp3_onkeyup(){
if(document.getElementById('inpo3').value.length==4){
document.getElementById('inpo4').focus()
}
}