For standard HTML attribute information about the <IMG> element, see the <IMG> topic.

The <IMG> element currently supports three scripting functions. All three are currently Netscape specific and are not mentioned in any W3C HTML specification. This is because they have been added by Netscape after they introduced the image object to their Object Model for JavaScript scripting, which allowed the script author to access methods and properties of images included in HTML documents.

OnAbort
If the user stops the download of your HTML document before any images defined in <IMG> elements have finished downloading, then (if present) this event handler will execute whatever script function it is set to activate. For example, if you use large graphics and the user cancels the download because they are accessed slowly, perhaps they would prefer to be transferred to a low-graphics version of your site?

OnError
This event handler can be used to execute script functions if there is an error while the image is downloading (perhaps caused by an incorrect SRC="..." declaration in the <IMG> element, or a network error).

OnLoad
The OnLoad event handler can execute script functions when the browser has succesfully displayed the image specified in the <IMG> element. For example, as Netscape supports the image object in it's Object Model, using this event handler (in conjunction with the OnError event) can be useful for tracking whether the images have been succesfully displayed or not.


Scripting the <FRAMESET> element Scripting Reference Overview Scripting Reference Comparison Table