Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 Display Modes
  #1 (permalink)  
Old July 23rd, 2007, 02:01 AM
Authorized User
 
Join Date: Apr 2007
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default pointing cursor from one textbox to other textbox

On my asp page, I have got many Textboxes, Buttons. On clicking Enter key on one textbox, I want the cursor to be displayed on the second textbox so that entries can be done in this second textbox.... How to write code in javascript?


  #2 (permalink)  
Old July 25th, 2007, 09:44 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

You can simply write a JS function and pass the textbox id to which you want to move to, e.g. like below:

 function MoveOnClick(objId)
        {
            if (event.keyCode == "13")
                document.getElementById(objId).focus();
        }

Call it like this:
<input type="text" id="txtFirst" onkeydown=MoveOnClick('txtSecond')>

Regards
Mike

Don't expect too much, too soon.
  #3 (permalink)  
Old August 2nd, 2007, 03:41 PM
Authorized User
 
Join Date: Jun 2007
Location: monroe, newjersey, USA.
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to preetham.sarojavenkatesh
Default

 Private Sub SetFocus(ByVal ctrl As System.Object)
        Dim focusScript As String = "<script language='javascript'>"& _"document.getElementById('" +ctrl.ClientID& _"').focus();</script>"
            RegisterStartupScript("FocusScript", focusScript)
    End Sub
-------------
just use this javascript -its d much simplest type...

preet
 


Thread Tools
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
Move cursor to specific textbox mona_upm84 Excel VBA 3 September 22nd, 2016 10:29 AM
Move cursor to specific textbox mona_upm84 Excel VBA 0 September 29th, 2008 09:35 PM
Hide Cursor Blinking in textbox VB.NET asadullah Visual Studio 2005 0 October 6th, 2007 06:36 AM
How to set cursor position in a textbox? zayasv VB.NET 2 April 29th, 2006 07:09 AM
onkeypressevent Location of cursor in the textbox rungss Javascript 3 February 18th, 2006 08:37 AM



All times are GMT -4. The time now is 11:57 PM.


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