Auto Tab using JavaScript

Posted by Prince | 7:24:00 PM | | 0 comments »

Auto Tab Form Fields using JavaScript:
                   This a simple sample code for auto tab form fields using javascript.  It works in conjunction with the "maxlength" attribute of HTML, triggered whenever the user's input reaches the maxlength's value.
Code:

<script type="text/javascript">
/*
Auto tabbing script http://dotnetcluster.blogspot.in/
*/
function autoTab(current,next){
if (current.getAttribute&&current.value.length==current.getAttribute("maxlength"))
next.focus()
}

</script>

<b>Enter your input:</b>
<form name="fromAutoTab">
<input type="text" name="first" size="4" onkeyup="autoTab(this, document.fromAutoTab.second)"
    maxlength="3" />
<input type="text" name="second" size="4" onkeyup="autoTab(this, document.fromAutoTab.third)"
    maxlength="3" />
<input type="text" name="third" size="5" maxlength="4" />
</form>
  Try this demo:
  Enter your input:

0 comments

Related Posts Plugin for WordPress, Blogger...