Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 January 31st, 2007, 01:29 PM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Determining control that has focus in jscript

Hello all,

I am programming a web app in Visual Studio 2005 (VB) which is using Dart's PowerWEB HTML Textbox.

I am trying to capture the Tab Key using onkeydown in jscript and if the HTML Textbox has the focus, I want to kill the tabkey.

My code looks like this:

<script language="javascript" type="text/javascript">
function IEDownKeyCapture()
{
    if (window.event.keyCode == 9)
    { var ControlInFocusStr = ?????? <--- This is where I need help
       if (ControlInFocusStr == "HtmlBox1") {
          event.returnValue = false; // This kills the tab
       }
    }
}
</script>
</head>
<body
    onkeypress ="IEKeyCap()" >

<form id="frmApprovalForm" method="post" runat="server">
....
    <cc1:HtmlBox ID="HtmlBox1" runat="server"></cc1:HtmlBox><br />
.....
</form>
</body>
</html>

Can anyone tell me how I can get the name of the control that has focus when the Tab Key has been pressed?

Thanks for your help.
Bill
 
Old January 31st, 2007, 02:49 PM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I copied in the wrong code for <body>
It should be:
<body
onkeydown="IEDownKeyCapture()" >

Bill





Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining what field has focus? firefighter2045 Access VBA 4 November 6th, 2007 12:58 PM
Can't move focus to control <control scptech Access VBA 8 October 26th, 2007 12:16 PM
Can't get focus on user control drb2k2 C# 2 December 15th, 2004 12:51 PM
Control Focus of Page mahulda General .NET 1 July 23rd, 2004 08:52 AM
using jscript in with a .net user control Morrislgn Javascript How-To 0 April 2nd, 2004 12:41 PM





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