JavaScript Examples


onLoad & onUnLoad


This text has already been written, and you may even have had a chance to read it. But a window will soon open, welcoming you to the page.

The onLoad event activated the welcome() function after the entire page had loaded.

The onUnLoad event activates the goodbye() function when leaving the page.

The functions use the window.alert() method to display message boxes to the user.


Taken from:

Book: JavaScript by Example
Publisher: Que Publishing
Chapter: 4
Listing: 4.2
Additions by: R. Hinton