Window.onload (Property)

A reference to a loading completed event handler for this window object.


JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Function object
JavaScript syntax:-myWindow.onload
-myWindow.onload = aHandler
-onload = aHandler
HTML syntax:<BODY onLoad="aHandler"> <FRAMESET onLoad="aHandler">
Argument list:aHandlerAn event handler function object

This is called when a <BODY> or <FRAMESET> has completed loading. This event is generated when all document parsing is done, all script blocks are fully operational and all functions defined and accessible. The Document Object Model should have been fully constructed by this time.

The onload event handler is a function which is represented by an object that is referred to by this property. Because it is stored in a property, you can change the handler by storing a reference to a different function object in this property. However, because this is called when loading is completed and not again after that, you can logically only modify this value during page loading.

The handler is registered either by assigning a function to the onfocus property or by defining it with an HTML tag attribute.


See also:onLoad, Window.onunload

Property attributes: