Fires when the object is set as the active element.
No return value.
The DISPID for this event is defined in mshtmdid.h. Use this value to identify the event handler when implementing IDispatch::Invoke.
Bubbles Yes Cancels No To invoke
- Click an element, other than the active element of the document.
- Use the keyboard to move focus from the active element to another element.
- Invoke the setActive method on an element, when the element is not the active element.
Default action Change activation from the event.fromElement to the event.srcElement.
Note 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.
When one object loses activation and another object becomes the activeElement, the HTMLOptionButtonElementEvents::onfocus event fires on the object becoming the activeElement only after the HTMLOptionButtonElementEvents::onblur event fires on the object losing activation.
Each document may have up to one active element. Set the active element with the IHTMLElement3::setActive or IHTMLControlElement::focus methods.
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.
For Microsoft Internet Explorer 5.5 and later, focus on a document, and the active element of a document can be managed separately. Use the HTMLOptionButtonElementEvents::onactivate event to manage formatting changes when an element is made active.