When this page is loaded with Netscape 3.0, two alert
popups are
shown: "An image loaded
" and "imageB has been
loaded.
" (NB. check that one is not obscured by the other, eg., by
acknowledging it).
With Netscape 4.03, only the second is displayed.
This example is copied from the Netscape
JavaScript Guide (which still describes JavaScript 1.1,
but there is no mention of a change in this area in What's
New in JavaScript 1.2), onLoad
Event
handler Example 2 (local copy). As can be checked with View | Page Source (or
with the copy below), the only change I have made is to the
image SRC
attribute to specify a local image.
<SCRIPT> imageA = new Image(50,50) imageA.onload=displayAlert imageA.src="construction3_small.gif" function displayAlert(theImage) { if (theImage==null) { alert('An image loaded') } else alert(theImage.name + ' has been loaded.') } </SCRIPT> <IMG NAME="imageB" SRC="construction3.gif" ALIGN="top" onLoad=displayAlert(this)><BR>