HTMLWindowEvents4::onfocusout Event

New for Internet Explorer 9

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

Fires for the current element with focus immediately after moving focus to another element.

Syntax

void onfocusout(
    IHTMLEventObj *pEvtObj
);

Parameters

Return Value

No return value.

Event DISPID

DISPID_HTMLWINDOWEVENTS4_ONFOCUSOUT

The DISPID for this event is defined in mshtmdid.h. Use this value to identify the event handler when implementing IDispatch::Invoke.

Event Information

Bubbles Yes
Cancels No
To invoke
  • Click a document, when the document does not have focus.
  • Click an element, other than the current element with focus.
  • Use the keyboard to move focus from the active element to another element.
  • Invoke the focus method on an element, when the element is not the active element.
Default action N/A

Event Object Properties

The IHTMLEventObj interface contains additional information about the current event. When the onfocusout event is fired, you can use the IHTMLWindow2::event property to retrieve an IHTMLEventObj interface. To obtain an alternate interface pointer such as IHTMLEventObj2 or IHTMLEventObj3, call QueryInterface on the object.

Refer to the specific event object for additional event properties.

Remarks

With Microsoft Internet Explorer 5.5 and later, focus on a document and the active element of a document can be managed separately. Use the HTMLWindowEvents4::onfocusout event to manage formatting changes when an element loses focus.

Each document may have up to one active element. Set the active element with the IHTMLElement3::setActive or IHTMLControlElement::focus methods. Using the IHTMLElement3::setActive method has no effect on document focus. Using the IHTMLControlElement::focus method on an individual element causes the element to gain focus and become the active element, and this causes HTMLWindowEvents4::onfocusout to fire for this active element.

Using the IHTMLControlElement::focus method on a document that does not have the focus moves the document to the front of the display. Additionally, the document's active element gains focus, and this causes HTMLWindowEvents4::onfocusout to fire for this active element.

For a given display, only one element has focus at any given time. Striking a key directly affects only the element with focus. Events fired by that keystroke may be scripted to affect other documents and child elements.

See Also

HTMLElementEvents::onfocusin, HTMLElementEvents::onbeforedeactivate, HTMLElementEvents::ondeactivate, HTMLElementEvents::onbeforeactivate, HTMLElementEvents::onactivate