onsave Event

MS Office DHTML, HTML & CSS

onsave Event


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

Syntax

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

Remarks

Bubbles No
Cancels Yes
To invoke
  • Save the Web page.
  • Bookmark the Web page.
  • Navigate to another page.
Default action Initiates any action associated with this script.

Event Object Properties

Although event handlers in the Dynamic HTML (DHTML) 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 onsave event handler, click the following link.

Event Object Properties

srcElementRetrieves the object that fired the event.

Example

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

Sample Code

<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 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, saveSnapshot

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.