1.可以在onchange or onkeydown事件里判斷maxlength.一旦達到.就跳轉焦點
例:
function chk1()
{
  if((document.all.t1.value).length==document.all.t1.maxlength)
  document.all.t1.focus()
}
<input type="text" id="t1" onkeydown="chk1()" maxlength="10">
<input type="text" id="t2">

解决方案 »

  1.   

    <script>
    function chk1(obj,length)
    {  
    if(obj.value.length==length)
        event.keyCode=9;
    }
    </script>
    <input type="text" id="t1" onkeydown="chk1(this,5)" maxlength="5">
    <input type="text" id="t2" onkeydown="chk1(this,3)" maxlength="3">
    <input type="text" id="t3">
      

  2.   

    以上两种方法好像不行啊!当input为空时还可以,如果input框的value的长度等于maxlength时,想修改input框中的value就有问题了!
      

  3.   

    第一种<script>
    function chk1(obj,next)
    {  
    if(obj.value.length==obj.maxLength)next.focus();
    }
    </script>
    <input type="text" id="t1" onkeyup="chk1(this,t2)" maxlength="5">
    <input type="text" id="t2" onkeyup="chk1(this,t3)" maxlength="3">
    <input type="text" id="t3"> 
      

  4.   

    第二种
    <script>
    function chk1(obj,length){ 
    window.status=event.keyCode;
    if(event.keyCode>46&&document.selection.createRange().text.length==0&&obj.value.length==length)   event.keyCode=9;
    }
    </script>
    <input type="text" id="t1" onkeydown="chk1(this,5)" maxlength="5">
    <input type="text" id="t2" onkeydown="chk1(this,3)" maxlength="3">
    <input type="text" id="t3">