Share via

activeElement property

[This documentation is preliminary and is subject to change.]

Gets the object that has the focus when the parent document has focus.


HRESULT value = object.get_activeElement(IHTMLElement** p);

Property values

Type: Object

the element that has the focus.


You can set the active element with the IHTMLElement3::setActive method or the IHTMLElement2::focus method; however, using the IHTMLElement3::setActive method has no effect on document focus. Use the IHTMLElement2::focus method to cause an individual element to gain focus and become the active element.

The active element retains focus in the parent document even when focus is shifted from the parent to another application. If the focus returns to the parent document, focus also returns to the same active element.

Note  For versions of Microsoft Internet Explorer 5 and later, the IHTMLDocument2::activeElement property is not defined until a document is loaded. A value of NULL is given for this property, if it is accessed inline during the loading of a document. This property can be accessed in the HTMLFrameSiteEvents::onload event handler function.

Note  Microsoft Internet Explorer 4.0 returns body as the IHTMLDocument2::activeElement when it is accessed inline during the loading of a document.



Build date: 6/12/2012