Share this page 

Auto tab in form fieldsTag(s): Form


<script>
function autotab(current,to){
    if (current.getAttribute && 
      current.value.length==current.getAttribute("maxlength")) {
        to.focus() 
        }
}
</script>

<b>Enter your phone number ex (1-888-555-1234):</b>
<form name="telephone">
<input type="text" name="phone0" 
    size=2 onKeyup="autotab(this, document.telephone.phone1)" maxlength=1>- 
<input type="text" name="phone1" 
    size=4 onKeyup="autotab(this, document.telephone.phone2)" maxlength=3>- 
<input type="text" name="phone2" 
    size=4 onKeyup="autotab(this, document.telephone.phone3)" maxlength=3>- 
<input type="text" name="phone3" size=5 maxlength=4>
</form>
Try it :
Enter your phone number ex (1-888-555-1234):
- - -