Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Javascript to autotab to next input field after max characters entered

Posted on 2001-07-20
3
Medium Priority
?
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 600 total points
ID: 6303214
<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
ID: 6303223
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
ID: 6303224
thanks for the quick response.  perfect!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

721 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