onload Event

MS Office DHTML, HTML & CSS

onload Event


Fires from a persistent element when the page reloads.

Syntax

Inline HTML <ELEMENT onload = "handler" ... > All platforms
Event propertyobject.onload = handler JScript (compatible with ECMA 262 language specification) only
Named script <SCRIPT FOR = object EVENT = onload> Internet Explorer only

Remarks

BubblesNo
CancelsYes
To invoke Load the persistent Web page from a favorite or shortcut or through an Internet address.
Default action Initiates any action associated with this script. The onload event for behaviors overrides the onload event for DHTML objects.

Event Object Properties

Although event handlers in the document object model do not directly receive parameters, the handler can query the event object for data. For a list of properties of the event object relevant to an onload event handler, click the following link.

Event Object Properties

srcElementRetrieves the object that fired the event.

Example

This example shows how to use the onload event for a persistence behavior.

Sample Code

<HTML>
<HEAD>
<META NAME="save" CONTENT="favorite">
<STYLE>
   .saveFavorite {behavior:url(#default#savefavorite);}
</STYLE>
<SCRIPT>
   function fnSaveInput(){
      oPersistInput.setAttribute("sPersistValue",oPersistInput.value);
   }
   function fnLoadInput(){
      alert("The onload event fired.");
      oPersistInput.value=oPersistInput.getAttribute("sPersistValue");
   }
</SCRIPT>
</HEAD>
<BODY>
<INPUT class=saveFavorite onsave="fnSaveInput()" onload="fnLoadInput()" 
    type=text id=oPersistInput>
</BODY>
</HTML>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
saveFavorite, saveHistory

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.