onLoad/onUnload


onLoad


The onLoad event handler is placed inside the body tag. It takes this format.
<Body onLoad="javascript statements">
The main use of onLoad is to transfer someone to another page. You also could make an alert, a confirm, or other javascript methods appear.

To transfer someone to another page, add the following line of coding inside the body tag.
onLoad="window.location='url_to_link_to'"
By now, you probably are starting to understand how event handlers work. You put down the name of the event handler, then the object you want it to affect, and finally the value of that object. Here it is saying, when the body loads, the location is "url_to_link_to"

onUnload


onUnload is the same except something happens when the viewer leaves that page. One could make really annoying pages by using the onUnload and having it send you back to the page you just came from.
Click here is an example of onLoad and onUnload examples. The next section is the onSubmit/onReset event handlers.
Back Homepage Event Handlers Next