onload event
[This documentation is preliminary and is subject to change.]
Fires immediately after the client loads the object.
Syntax
HTML Attribute | <element onload = "handler(event)"> |
Event Property | object.onload = handler; |
attachEvent Method | object.attachEvent("onload", handler) |
addEventListener Method | object.addEventListener("load", handler, useCapture) |
Standards information
- HTML 4.01 Specification, Section 18.2.3
Event information
Synchronous | No |
Bubbles | No |
Cancelable | No |
Event handler parameters
- pEvtObj [in]
Type: IHTMLEventObj
Remarks
The client loads applications, embedded objects, and images as soon as it encounters the applet, embed, and img objects during parsing. Consequently, the onload event for these objects occurs before the client parses any subsequent objects. To ensure that an event handler receives the onload event for these objects, place the script object that defines the event handler before the object and use the onload attribute in the object to set the handler.
The onload attribute of the body object sets an onload event handler for the window. This technique of calling the window onload event through the body object is overridden by any other means of invoking the window onload event, provided the handlers are in the same script language.
Loads the object for which the event is specified.
To invoke this event, do one of the following:
- Open a document to invoke this event for the document or any object within it.
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
See also
Reference
Build date: 1/23/2012