onerror event
Fires when an error occurs during object loading.
Syntax
HTML Attribute | <element onerror = "handler(event)"> |
Event Property | object.onerror = handler; |
attachEvent Method | object.attachEvent("onerror", handler) |
addEventListener Method | object.addEventListener("error", handler, useCapture) |
Event information
Synchronous | No |
Bubbles | No |
Cancelable | Yes |
Event handler parameters
- pEvtObj [in]
Type: IHTMLEventObj
Standards information
There are no standards that apply here.
Remarks
To suppress the default Windows Internet Explorer error message for the window event, set the IHTMLEventObj::returnValue property of the event object to true or simply return true
in Microsoft JScript.
The HTMLScriptEvents2::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).
Displays the browser error message when a problem occurs and executes any error handling routine associated with the event.
To invoke this event, do one of the following:
- Run-time script error, such as an invalid object reference or security violation.
- Error while downloading an object, such as an image.
- Windows Internet Explorer 9. An error occurs while fetching media data.
The pEvtObj parameter is required for the following interfaces:
- HTMLAnchorEvents2
- HTMLAreaEvents2
- HTMLButtonElementEvents2
- HTMLControlElementEvents2
- HTMLDocumentEvents2
- HTMLElementEvents2
- HTMLFormElementEvents2
- HTMLImgEvents2
- HTMLFrameSiteEvents2
- HTMLInputFileElementEvents2
- HTMLInputImageEvents2
- HTMLInputTextElementEvents2
- HTMLLabelEvents2
- HTMLLinkElementEvents2
- HTMLMapEvents2
- HTMLMarqueeElementEvents2
- HTMLObjectElementEvents2
- HTMLOptionButtonElementEvents2
- HTMLScriptEvents2
- HTMLSelectElementEvents2
- HTMLStyleElementEvents2
- HTMLTableEvents2
- HTMLTextContainerEvents2
- HTMLWindowEvents2
- HTMLDocumentEvents4
- HTMLElementEvents4