onbeforeunload Property

Returns or sets a Variant that represents the value of the onbeforeunload attribute that is the name of the script to run when the onbeforeunload event fires.

expression.onbeforeunload

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

The following example sets the onbeforeunload attribute for the BODY element in the active document.

ActiveDocument.body.onbeforeunload = "script()"

Applies to | FPHTMLBody Object | FPHTMLFrameSetSite Object | FPHTMLWindow2 Object | FPHTMLWindowProxy Object | IHTMLBodyElement Object | IHTMLFrameSetElement Object | IHTMLWindow2 Object