Solved

Javascript to autotab to next input field after max characters entered

Posted on 2001-07-20
3
286 Views
Last Modified: 2010-05-18
I need some javascript that will tab to the next input box once the maximum number of characters has been entered.  This is for entry of a telephone number and we need three different input boxes but don't want users to have to tab each time.  I'm sure this is simple, but I don't know how to do it.
0
Comment
Question by:juliefernandes
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 150 total points
Comment Utility
<INPUT type='text' name='field1' maxlength='3'
  onKeyUp='if(this.value.length==3)this.form.field2.focus();'>

<INPUT type='text' name='field2' maxlength='3'
  onKeyUp='if(this.value.length==3)this.form.field3.focus();'>

<INPUT type='text' name='field3' maxlength='4'>
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
Remember to surround the whole thing up there with <FORM> and </FORM> tags (especially if you are using Netscape).  Also, if you are using netscape, you must include this at the top of your page:

<SCRIPT language='javascript'>
  if ( document.layers )
    document.captureEvents( Event.KEYUP );
</script>
0
 

Author Comment

by:juliefernandes
Comment Utility
thanks for the quick response.  perfect!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now