Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 21st, 2006, 12:14 PM
Registered User
 
Join Date: Oct 2006
Location: Hyd, , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting Text Box Focus

Hi all,
I have two text boxes in asp.net web page
if i enter 2 letters in the textbox1 focus of the cursor should in textbox2

how can i write the code for this

pls help me out in the above problem





  #2 (permalink)  
Old November 22nd, 2006, 02:26 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

You can simply use this javascript function to move focus to the second textbox, call this function on the keypress event of first textbox as below:

<input type="text" id="txt1" onkeypress="MoveFocus(this.id,'txt2')">

here 'txt2' is the id of second textbox


function MoveFocus(source,target)
        {
            var source = document.getElementById(source);
            var target = document.getElementById(target);

            if(source.value.length >= 2)
                target.focus();

        }

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine which text box has focus JAnthony Access VBA 2 April 19th, 2006 02:29 PM
Setting the Focus BSkelding ASP.NET 1.0 and 1.1 Professional 1 May 12th, 2005 01:40 PM
Setting Focus on a Text Box in a Web Form vbmazza VB.NET 1 May 4th, 2005 09:19 AM
How to focus the insertion point in a text box larry Javascript How-To 3 April 2nd, 2004 07:12 PM



All times are GMT -4. The time now is 04:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.