Fires when an error occurs during object loading.
void onerror( IHTMLEventObj *pEvtObj );
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 No Cancels Yes To invoke Cause one of the following errors to occur:
- Run-time script error, such as an invalid object reference or security violation.
- Error while downloading an object, such as an image.
- Internet Explorer 9. An error occurs while fetching media data.
Default action Displays the browser error message when a problem occurs and executes any error handling routine associated with the event.
Event Object Properties
The IHTMLEventObj interface contains additional information about the current event. When the onerror 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.
IHTMLEventObj::altKey Gets a value that indicates the state of the ALT key. IHTMLEventObj2::altKey Gets a value that indicates the state of the ALT key. IHTMLEventObj3::altLeft Gets a value that indicates the state of the left ALT key. IHTMLEventObj3::ctrlLeft Sets or retrieves the state of the left CTRL key. IHTMLEventObj::returnValue Sets or retrieves the return value from the event. IHTMLEventObj3::shiftLeft Retrieves the state of the left SHIFT key. IHTMLEventObj::srcElement Gets the object that fired the event. IHTMLEventObj2::srcElement Gets or sets the object that fired the event. IHTMLEventObj::type Gets the event name from the event object. IHTMLEventObj2::type Gets or sets the event name from the event object.
Refer to the specific event object for additional event properties.
The HTMLInputImageEvents2::onerror event fires for run-time errors, but not for compilation errors. In addition, error dialog boxes raised by script debuggers are not suppressed by returning
true. To turn off script debuggers, disable script debugging in Internet Explorer by choosing Internet Options from the Tools menu. Click the Advanced tab and select the appropriate check box(es).