Previous Example-|-Next Chapter's Examples-|-Return to Chapter Listing

Example 12.9:
onunload: Not Always So Useful


This page actually demonstrates a problem with the onunload event handler in versions of Netscape earlier than 3.0 beta 4. Don't click on the TEST button below. Instead, enter text into the text box, then click on the Back button--if you are using Netscape 3.0 beta 3 or earlier nothing happens (well, except that the previous page loads--or, just maybe, your browser will crash). Return to this page and click on the TEST button. Close the Alert box that appears, and then click on the Back button. This time the onunload event handler runs properly, and the Alert box appears again.

Type your account name:


We started with this script: <SCRIPT LANGUAGE="JavaScript"> <!-- function Bye() { var sAname = document.AccountForm.account.value alert("Please make a note of your account name (" + sAname + "), and remember to bookmark this Web page"); } //--> </SCRIPT> </HEAD> <BODY onunload="Bye()"> And we've got this button, too: <FORM NAME="AccountForm"> Type your account name: <INPUT TYPE="TEXT " NAME="account"> <INPUT TYPE="BUTTON" NAME="TEST" VALUE="TEST" onclick="Bye()"> </FORM>
Previous Example-|-Next Chapter's Examples-|-Return to Chapter Listing