There is an onError event defined as part of the set of events supported by JavaScript. However, as of JavaScript version 1.2, the onError event is actually only supported by Image objects when defined in HTML tag attributes. You can add an error handler to a window object with the onerror property.
The <IMG onError="..."> tag element allows an error during image loading to be handled gracefully.
Attaching an error handler to a window with the window.onerror property allows JavaScript errors to be intercepted.
Error events have a slightly different parameter passing API so although they are events, they are slightly different to the rest of the event model.
See also: | Error handler, Event handler, Event model, onError, Window.onerror |
Prev | Home | Next |
Error | Up | Error handler |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |