Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript 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, 01:02 AM
Authorized User
 
Join Date: Apr 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript to move cursor frm one textbox to othr

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


 
Old July 23rd, 2007, 05:16 AM
Authorized User
 
Join Date: Jun 2007
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi lakshmi_annayappa

Place a client side javascript onkeypress handler for each textbox and check code of pressed key with key code of 'Enter' key (number 13). If it is, then make focus to next control on your page.
It should be something like below :

function onkeypressHandler()
{
    if(event.keyCode == 13)
    {
        // Enter has been pressed
        getNextElement(event.scrElement).focus();
    }
}

getNextElement() could be implemented as a general method that accepts an element as an input parameter and returns an element that it's tabIndex property is one more than input element.

Also take a look at this topic :

http://www.thescripts.com/forum/thread503195.html


Ehsan Zaery Moghaddam





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
Move image when cursor approaches sanjana Pro Visual Basic 2005 1 July 19th, 2007 04:55 PM
Word-unable to move cursor using mouse. jahid General .NET 0 February 6th, 2007 06:10 AM
how shall I move the cursor? nerssi Javascript 0 September 21st, 2004 09:27 AM





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