The onLoad Event

The onLoad command is very useful. Unlike other Event Handlers that I've learned about, this one sits within the HTML document's BODY flag. It's enacted when the page finishes loading into the browser window. The following example will pop up a simple alert box to welcome the user to the page:

HTML file: Displayed by browser:
<body onLoad="alert('Thanks for coming to my webpage')")>

<h1>My HTML Page.</h1>

</body>

My HTML Page.

As I progress further into Javascript, I understand that this command will be used, with increased frequency, to trigger larger scripts to start working. Apparently, this will become an important tool in my JavaScript toolbox.

BackTable of ContentsNext