Javascript Reference
Categories: onload

javascript onload Description

@March 15, 2008, 1:22 a.m.
onloadFirefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM 2  

Bubbles: No; Cancelable: No  

Fires when external content belonging to the current element or object finishes loading and initializing. This event handler for the window object is perhaps the most important because it signals that all content of the document and its elements (including external content) has loaded before the event fires. When that event fires, your scripts can reference any document tree object without error.


The event fires for a frameset element only after the onload events for all frames have fired (but the event is not bubbling from frame to frameset). Note that if the user or a script loads a new page into a frame after the frameset's initial load, the onload event does not fire again for the frameset (but it does for the frame).


Although the onload event has been supported for window objects since the early days of scriptable browsers, modern browsers fire the event on virtually any other rendered element that loads external content.

Typical Targets

For all browsers, window objects; for Version 4 browsers or later the img element; for IE 4 or later and Netscape 6, add any rendered element capable of loading external content.

Powered by Linode.