Assignment #7

This assignment will require the use of onUnload, an onMouseOver and an onMouseOut. What should happen is:

HTML file: Displayed by browser:
<body onUnload="alert('Leaving so soon?')">

<a href="thanxalot.html"
onMouseOver="window.status='Hello ' +navigator.appName+ ' user - Click here!';
return true"
onMouseOut="window.status='You should leave ' +document.location+ ' right away';
return true">Here is the link</a>

</body>
Here is the link

The answer page didn't exactly follow the assignment guidelines, in regards to the onUnload line. Their line only changed the color of the page when it loaded. It did not bring up an alert box at all, when leaving the page. This is their code:   <body bgcolor="FFFFCC" onUnload="goodbyedate()">

The onMouseOver and onMouseOut commands are the same, with the exception of calling for the navigator.appName in the first event, and document.location in the second. The trick to this long line is where to place all the single and double quotes. Notice the pattern above -- each of the window.status commands is surrounded in double quotes. The text bits inside have single quotes. The important point is to take care to end all single and double quotes.

BackTable of ContentsNext