Previous Example-|-Next Example-|-Return to Chapter Listing

Example 12.11:
onabort: When the User Clicks Stop

[This example works with Netscape Navigator 3. It will not work with Internet Explorer 3.]

Click your browser's Stop button to stop the picture loading and display a confirm box (if the picture's already loaded, click Reload and then immediately click Stop. We used the onabort event handler to run the doNotGo() function which displayed the Confirm dialog box. The onabort event handler also works if you click a link to go to another page before the image has finished loading.


This is the script we used in the HEAD: <SCRIPT LANGUAGE="JavaScript"> <!-- function doNotGo() { if (confirm("'Ere, 'ang on, you haven't seen everything yet! Why not let the image finish loading before you leave! Click OK to continue loading.")) { history.go(0) } } //--> </SCRIPT> In the BODY of the page we have this image tag: <IMG SRC="bell.gif" WIDTH=144 HEIGHT=119 onabort="doNotGo()">
Previous Example-|-Next Example-|-Return to Chapter Listing