Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-10-2004, 04:25 PM   PM User | #1
markhartnady
New Coder

 
Join Date: Feb 2004
Location: Switzerland
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
markhartnady is an unknown quantity at this point
Changing focus when text length reaches limit

I need to change the focus of a text box when its text length reaches 2.

I.e.:

Three text boxes:

1: [ ] 2: [ ] 3: [ ]

Now when the user types in box 1 and the text length reaches 2 it should set focus to the second.

I tried this:

<input name="text1" onChange="javascript:
if (document.form.text1.length == 2) document.form.text2.focus();
">

But it didnt work.
markhartnady is offline   Reply With Quote
Old 03-10-2004, 04:34 PM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
Try this:
Code:
<input name="text1" onkeyup="javascript: 
if (this.value.length == 2) document.form.text2.focus();">
.....Willy

Edit: Added 'purty colors
Willy Duitt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:29 AM.


Advertisement
Log in to turn off these ads.