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 property object.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.
srcElement Retrieves 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>
Applies To
[ Object Name ] Platform Version Win16: Win32: Mac: Unix: WinCE: Version data is listed when the mouse hovers over a link, or the link has focus. saveFavorite, saveHistory, saveSnapshot
Did you find this topic useful? Suggestions for other topics? write us!
© 1999 microsoft corporation. all rights reserved. terms of use.