onload

HTML (DHTML)

onload Event

Internet Development Index

Fires from a persistent element when the page reloads.

Syntax

Event propertyobject.onload = handlerJScript only
object.onload = GetRef("handler")Visual Basic Scripting Edition (VBScript) 5.0 or later only
Named script <SCRIPT FOR = object EVENT = onload> Internet Explorer only

Event Information

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.

Available Properties

Available Properties

Example

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

<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 Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

There is no public standard that applies to this event.

Applies To

saveFavorite, saveHistory