标签:
---恢复内容开始---
<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>
---恢复内容结束---
标签:
原文地址:http://www.cnblogs.com/Mesiky/p/5700934.html