onsave

HTML (DHTML)

onsave Event

Internet Development Index

Fires from a persisted element when the Web page is saved or bookmarked, or when the user navigates away from the page.

Syntax

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

Event Information

BubblesNo
CancelsYes
To invoke
  • Save the Web page.
  • Bookmark the Web page.
  • Navigate to another page.
Default action Initiates any action associated with this script.

Available Properties

Available Properties

Example

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

<HTML>
<HEAD>
<META NAME="save" CONTENT="favorite">
<STYLE>
.saveFavorite {behavior:url(#default#savefavorite);}
</STYLE>
<SCRIPT>
function fnSaveInput(){
alert("The onsave event fired.");
oPersistInput.setAttribute("sPersistValue",oPersistInput.value);
}
function fnLoadInput(){
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, saveSnapshot