onUnload

This event handler will execute the instruction when the document is 'unLoaded'. That is, when you leave the current page.

syntax:

document.onUnload = function()

The onUnload Event Handler is used with the following:

BODY
FRAMESET
window