Name
Window.onload: event handler invoked when a document finishes loading — JavaScript 1.0:
Synopsis
Function onload
Description
The onload property of a
Window specifies an event handler function that is invoked when a
document or frameset is completely loaded into its window or
frame.
The initial value of this property is a function that contains
the semicolon-separated JavaScript statements specified by the
onload attribute of the <body> or <frameset> tags.
When the onload event
handler is invoked, you can be certain that the document has fully
loaded, and therefore that all scripts within the document have
executed, all functions within scripts are defined, and all document
elements have been parsed and are available through the Document
object.
You can use Window.addEventListener(
) or Window.attachEvent(
) to register multiple event-handler functions for onload
events.
See Also
Window.onunload; Manipulating the Document During Loading, “Manipulating the Document
During Loading,” Example 17-7, Chapter 17
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access