onunload | NN 2 IE 3 DOM 2
| Bubbles: No; Cancelable: No
Fires just before the current document begins to unload due to impending navigation to a new page, form submission, or window closure. This event fires after the onbeforeunload event in browsers that support that event. In most browsers, the actual document unloading does not wait for the onunload event handler function to complete. Therefore, if the function performs too many actions, especially those that rely on script variables and elements in the current page, those references may become invalid while the function runs, creating script errors (of the "undefined" or "object not found" variety). Therefore, keep onunload processing to a minimum.
Typical Targets
The body and frameset elements, plus the window object.