|Property/method value type:||Function object|
|-||myWindow.onload = aHandler|
|-||onload = aHandler|
|HTML syntax:||<BODY onLoad="aHandler"> <FRAMESET onLoad="aHandler">|
|Argument list:||aHandler||An 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.
There are certain things you cannot do until this point in the page loading process. For example, you cannot use inline document.write() methods to construct an <OBJECT> embed in MSIE. You can however enclose a dummy <OBJECT> block inside a <DIV> and then replace the innerHTML of that <DIV> with a script generated <OBJECT> block that is provided in an onload event handler. There are some issues about how tightly that plugin is bound to the browser window. It is possible that a plugin that plays video may not track window drags with live updates to the screen quite as elegantly as an <OBJECT> block that is manifestly constant and not defined by a script.
There is a bug in the way that the onload event handlers are invoked in Netscape Navigator 2. Logically, one would assume that the onload handler for the <FRAMESET> would be called once all of the individual frames within it have been fully loaded. However, Netscape 2 calls this prematurely and so you should make sure that you have a way to check that every one of your frames has loaded individually.