Example of using the body tag's events: onLoad() & onUnload().
Click here - if you came to this page
from a search engine. This page was designed to be viewed in a series of
- Look at the HTML source. The body tag calls fonLoad() when the page
loads and fonUnload() when the page unloads.
- fonLoad() function creates a popup message using the alert() function.
- fonUnload() function creates a popup message using the alert() function,
then creates a new window with ex_window_bodytab_load2.htm as the web page.
Differences using IE vs Netscape: (I'm using IE 5.5 & NS 4.7)
- onLoad() event's alert() function works in both IE & Netscape.
- If browser window is closing, event's work in IE,
but do not work in
- If browser is changing URL's but is still open, event's work with IE & Netscape.
- Netscape note - as long as the window is open, when pages are
unloaded Netscape will call the onUnload() event.
Do the following to test:
- Close the browser window by clicking on the "X" in the upper
- Goto another URL by typing in your favorite site.
- Goto another URL by clicking on this link: www.yahoo.com