---恢复内容开始---
<html>
<head>
<script>
window.onload=function(){
var form=document.getElementsByTagName(‘form‘)[0];
var txt=form.elements[‘txt1‘];
var txt1=form.elements[‘txt2‘];
txt.onkeyup=function(){
if(this.value.length==this.maxLength){
for(var i=0;i<form.elements.length;i++){
if(form.elements[i]==this){
form.elements[i+1].focus();
}
}
}
}
}
</script>
</head>
<body>
<form>
<input type="text" name="txt1" maxlength="5">
<input type="text" name="txt2" maxlength="4">
</form>
</body>
</html>
---恢复内容结束---
时间: 2024-10-08 17:14:03