onerror event | error event
Fires when an error occurs while loading an external file.
How to register:
|object.onerror = handler;|
|object.addEventListener ("error", handler, useCapture);|
|object.attachEvent ("onerror", handler);|
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
Actions that invoke the onerror event:
- When an error occurs during loading an external file.
Example HTML code 1:
This example illustrates the use of the onerror event on image elements:
Example HTML code 2:
This example only works in Internet Explorer. It shows how to detect when an external style file cannot be imported:
Example HTML code 3:
User Contributed Comments