Wrox Programmer Forums
|
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 September 2nd, 2004, 08:09 PM
Authorized User
 
Join Date: Jul 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Focus

I am trying to use up/down arrow keys to hightlight rows in a ASP datagrid. I am using the onkeydown to trap the keys. However, I have other controls on the web page, like a drop down box. If user uses arrow keys to select a value in the drop down box, focus goes to data grid and begins highlighting a row there. User can not select the value in the drop down box with this going on. In JavaScript, how do I determine if the user has focused on the DataGrid? Logic I like to find: If the user has focus on another control, allow him/her to use arrow keys. If focused on datagrid only, allow arrow keys for moving up and down rows.

Any suggestions? Thank you,

Paul

 
Old September 3rd, 2004, 03:41 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Try using the document.activeElement to see where you are or maybe the event.srcElement in your handler.

--

Joe
 
Old September 3rd, 2004, 04:48 PM
Authorized User
 
Join Date: Jul 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, that was very helpful. However, I'm using the ASP Controls Calendar and Datagrid too. These don't seem to be detected document.activeElement or event.srcElement. They find and return information for text boxes, drop down list and other controls, but not the Calendar and Datagrid. Do you have any tips for this?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Focus dhoward Javascript 3 September 19th, 2007 02:54 AM
Focus dhoward VB.NET 2002/2003 Basics 0 September 13th, 2007 02:23 PM
focus kvanchi General .NET 2 December 13th, 2004 09:16 PM
Focus jbenson001 ASP.NET 1.x and 2.0 Application Design 2 February 18th, 2004 02:14 PM





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