Window.onunload (Property)

This event handler is called when a document is cleared from a window.

Availability:

JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Property/method value type:Function object
JavaScript syntax:-myWindow.onunload
-myWindow.onunload = aHandler
-onunload
-onunload = aHandler
HTML syntax:<BODY onUnload="aHandler"> <FRAMESET onUnload="aHandler">
Argument list:aHandlerAn event handler function object

This is called when a <BODY> or <FRAMESET> is about to be replaced by some new content.

The onunload event handler is a function which is represented by an object that is referred to by this property. Because it is stored in a property, you can change the handler by storing a reference to a different function object in this property.

The handler is registered either by assigning a function to the onfocus property or by defining it with an HTML tag attribute.

In a frame-set collection, the individual onunload handlers for each frame will be called in turn before the onunload event handler for the <FRAMESET> is called.

Use of this event handler is discouraged on the WebTV platform. There are limitations on its availability at certain times during alert and refresh actions.

See also:JellyScript, onLoad, onUnload, Window.onload

Property attributes:

DontEnum.