Why does'nt this work?
<BODY>
<SCRIPT language="JavaScript">
window.onLoad=alert("onLoad() called."
window.onUnload=alert("onUnload() called."
alert("In Body"
</SCRIPT>
</BODY>
I would have expected the "In Body" alert to appear first, then the "onLoad" alert and nothing else. When I exit the window, I should get the "onUnload" alert. Instead, the 3 alert()s appear in the order in which they appear in this code. If I put these methods in the <BODY> tag, they get invoked as expected (i.e., <BODY onLoad="alert('onLoad() called.');" ...> ). BTW, it doesn't work on NS or IE.