Availability: |
| ||||||
Property/method value type: | Boolean primitive | ||||||
JavaScript syntax: | - | myObject.onunload = aHandler | |||||
HTML syntax: | <BODY onUnload="aHandler"> <FRAMESET onUnload="aHandler"> <HTMLTag onUnload="aHandler"> | ||||||
Argument list: | aHandler | A reference to a function object to handle the event |
The onUnload event is triggered for a <BODY> or <FRAMESET> tag when the page is about to disappear and be replaced with another. You should avoid doing anything lengthy or complex here - it should just be used to do some cleaning up.
It is considered bad technique to place an alert or any other dialog in the onUnload handler. It is also bad manners to tie the processing up in a lengthy piece of script execution at this stage.
You might use the unLoad handler to remove any values you put into the window status bar.
Although this is a tag attribute that is applied to the <BODY> tag, it is really associated with the Window object in which the document body is loaded.
Prev | Home | Next |
onSubmit | Up | open() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |