onLoad (Event handler)

Triggered when an object has completed loading.

Availability:

JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera browser - 3.0
Property/method value type:Boolean primitive
JavaScript syntax:-myObject.onload = aHandler
HTML syntax:<BODY onLoad="aHandler"> <BODY onUnload="aHandler"> <FRAMESET onLoad="aHandler"> <FRAMESET onUnload="aHandler"> <HTMLTag onUnload="aHandler"> <IMG onUnload="aHandler">
Argument list:aHandlerA reference to a function object to handle the event

This event is associated with <BODY> and <FRAMESET> tags. It is triggered when either has finished loading.

In the case of a <BODY> tag, that is when all images are loaded and any <APPLET> or plugin items have started running.

In the case of the <FRAMESET> tag, it is when all frames have loaded and arguably should be after all <BODY> tags have triggered their onLoad events. However, you probably should not rely on the last <BODY> onLoad event occurring before the <FRAMESET> onLoad event.

In any case, it would probably be bad form to have too many onLoad handlers activated during a page load.

Although it is associated with <BODY> and <FRAMESET>, the event is owned by the window object in the Document Object Model.

Warnings:

See also:Event, Event handler, Event model, Event names, Event object, Event.returnValue, Handler, onAbort, onError, onUnload, Semantic event, Window events, Window.onload, Window.onunload

Supported by objects:

APPLET

AREA

BODY

FRAMESET

IMG

Layer

LINK

SCRIPT

STYLE

Window