OnLoad and UnLoad Events in VBScript


The onLoad event is executed upon the loading of the document and the onUnload event is executed when a new document is loaded or the browser window is closed.


<HEAD>
<SCRIPT LANGUAGE="VBSCRIPT">
<!--
	Sub window_onLoad
		MsgBox "Welcome to my home page!",,"Welcome!"
		status = "Welcome to my home page!"
	End Sub
	
	Sub window_onUnload
		MsgBox "Thanks for visiting. Come by again soon!",,"CYA!"
	End Sub
-->
</SCRIPT>
</HEAD>