document.onunload : onunload « Document « JavaScript Tutorial






Syntax

onUnLoad="command"

The onUnLoad event is fired when the page is unloaded.

This occurs when the user leaves the page for another page.

This event handler actually belongs to the Window object but is accessible through the Document object.

The onunLoad event handler in the of a document that is loaded in a frame will fire before an event loaded in the tag that loaded the document.

<html>
    <body onunload='alert("Please do not leave!")'>
</html>








14.28.onunload
14.28.1.document.onunload
14.28.2.onUnload event for body tag