window.onLoad

JavaScript1.0+, JScript1.0+ Nav2+, IE3+, Opera3+ Syntax

onLoad="command"

Description

The onLoad event handler of a property of a Window object is fired when the page has finished loading in that particular window instance.

Note

The onLoad event handler in the <body> of a document that is loaded in a frame will fire before an event handler loaded in the <frameset> tag that loaded the document.

Example

Listing 7.559 pops up an alert box when the page has finished loading.

Listing 7.559 Example of Using the onLoad Event
<body onLoad='alert("The document has completely loaded.")'>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.