There are two ways of catching errors in a web page:
|
|
The try...catchtry block contains the code to be run, and the catch block contains the code to be executed if an error occurs.
Note that try...catchThe example tries to display the message try...catchalert is misspelled, a JavaScript error occurs.
|
|
err.
It will be discussed in the next slide.
The onClick event executes JavaScript code when a click event occurs; that is, when an object on a form is clicked.