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

Example 12.14:
onerror: Suppressing Errors and Displaying a Message

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

This is similar to the previous example, but this time we've used a different method for suppressing the error messages--we've used return true and we've also displayed an error message of our own making.


In the HEAD we have this script: <SCRIPT> <!-- window.onerror=runError function runError() { alert("Uh, oh, you've encountered a JavaScript error. Do you have the latest version of Netscape Navigator? If not go to http://www.netscape.com/ and download it.") return true } //--> </SCRIPT> In the BODY of the page we have this button: <form> <input name="error" type="button" value="Click Here to Create Error" onclick="null()"> </form>
Previous Example-|-Next Example-|-Return to Chapter Listing