| ||||||||||||||||||||||||||||||||||||||||||||||||
onload EventFires immediately after the browser loads the object. Syntax
Remarks
A load event occurs when the user agent finishes loading all content within the document's BODY, all frames within a FRAMESET, or an OBJECT element. The onload attribute of the BODY object sets an onload event handler for the window. This technique of calling the window onload event through the BODY object is overriden by any other means of invoking the window onload event, provided the handlers are in the same script language. In Internet Explorer®, the onload event can be applied to the following objects as well: APPLET, EMBED, and IMG. As the browser loads applications, embedded objects, and images as soon as it encounters the objects during parsing, the onload event for these objects occurs before the browser parses any subsequent objects. To ensure that an event handler receives the onload event for these objects, the SCRIPT object that defines the event handler must be placed before the object and the onload attribute in the object used to set the handler. Event Object PropertiesWhile event handlers in the Document Object Model do not receive parameters directly, the handler can query the event object for data.
ExampleThis simple example demonstrates use of the onload event to notify when a page has loaded.
<script for=window event=onload>
alert("The page has loaded.");
</script>
The following example shows use of the onload event to trigger a function as the page loads. Applies ToAPPLET, EMBED, FRAMESET, IMG, LINK, OBJECT, SCRIPT, STYLE, window See Also |
| |||||||||||||||||||||||||||||||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme