When browsing Webpages on the internet, we all have seen a Java Script alert box telling us there is a runtime error and asking "Do you wish to debug?". Error message may be useful for developers but not for visiter. When users see errors, they often leave the Webpage.
This Academic Tutorial chapter will teach you how to trap and handle Java Script error messages, so you don't lose your audience.
There are two ways of catching errors in a Webpage:
By using the try...catch statement (available in IE5+, Mozilla 1.0, and Netscape 6)
By using the onerror event. This is the old standard solution to catch errors
|