Note: The onload event occurs after the page is fully loaded, this includes downloading pictures.
The following two functions are to handle the load and unload page of the page
function hello()
{alert("Welcome to my page");}
function goodbye()
{alert("Thank You, Surf by again.");}
Links to the above functions are placed in the <BODY> tag as shown below.
<BODY onload="hello()" onUnload="goodbye()">
<h1>Loading and unloading Test Page</H1>
</BODY>
Test the above in an HTML form.