There are two ways of catching errors in a web page:
|
|
The try...catch try block contains the code to be run, and the catch block contains the code to be executed if an error occurs.
Note that try...catch The example tries to display the message try...catch alert 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.