Navigator 2.0, Internet Explorer 3.0
<BODY a definition of the handler [ onLoad="JavaScript statements" ] ... > <FRAMESET another way to define the handler [ onLoad="JavaScript statements" ] ... > window.onload=handler-func defining the handler directly window.onload(); an explicit invocation of the handler
onload() is an event handler invoked by the browser when a document or frameset is completely loaded into the browser. The onload() handler is defined by the onLoad attribute of the <BODY> or <FRAMESET> HTML tags. The value of this attribute may be any number of JavaScript statements, separated by semicolons.
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 forms and other document elements have been parsed and are available through the Document object.
If any of your document's event handlers depend on the document being fully loaded, you should be sure to check that it is loaded before executing those handlers. If the network connection were to stall out after a button appeared in the document, but before the parts of the document that the button relied on were loaded, then when the user clicks the button they will get unintended behavior or an error message. One good way to verify that the document is loaded is to use the onload() handler to set a variable, loaded, for example, to true, and to check the value of this variable before doing anything that depends on the complete document being loaded.
JavaScript is supposed to guarantee that the onload() handler for each frame in a window will be invoked before the onload() handler for the window itself. Unfortunately, Navigator 2.0 does not always do this. Thus in a framed document, you may need to check that each of your individual frames has fully loaded.
file: /Techref/language/java/script/definitive/refp_451.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/30 03:13,
18.118.193.28:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/language/java/script/definitive/refp_451.htm"> [Chapter 21] Reference: Window.onload()</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.