Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 23rd, 2007, 02:01 AM
Authorized User
Join Date: Apr 2007
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?

Old July 25th, 2007, 09:44 AM
Friend of Wrox
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post

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")

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


Don't expect too much, too soon.
Old August 2nd, 2007, 03:41 PM
Authorized User
Join Date: Jun 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to preetham.sarojavenkatesh

 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...


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 09:37 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.