Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To 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 November 29th, 2003, 10:34 PM
Authorized User
 
Join Date: Aug 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get the object with input focus

I need to get the name of the object on the page that currently has input focus (this needs to happen in the onblur event of one object, so I can see what the focus has been transferred to).

Thanks!

 
Old December 1st, 2003, 05:29 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In IE this is the activeElement.
Code:
var oElement = document.activeElement;
alert(oElement.name);
--

Joe
 
Old December 1st, 2003, 05:40 AM
Authorized User
 
Join Date: Aug 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks heaps.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Focus on a text input field fizzerchris Classic ASP Basics 0 December 16th, 2005 09:20 PM
Text object methods focus() and select() John K. King Javascript How-To 7 May 9th, 2005 03:12 AM
focus kvanchi General .NET 2 December 13th, 2004 09:16 PM
Error using custom object as input in webservice overfried .NET Web Services 0 September 6th, 2004 05:06 AM





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