HTML and CSS Reference
In-Depth Information
331
Figure 16-3: Data entry and data output.
Second, the JavaScript routine in the
<head>
of the page triggers an alert message:
SendMaster
=
new Object
();
SendMaster.eLert
=
function
()
{
alert
(
“Oops! Seems to be a little boo-boo in the e-mail format.”
);
}
You might want to note two important features about the coding:
It uses
onInvalid
instead of
onError
.
h e
onError
event handler is so commonly
used for any kind of error that you might assume it would work here as well, but only
onInvalid
works in this case.
h e error-catching routine is in the
<input>
e-mail
instead of the
<input>
submit
tag.
Because the error occurs on clicking the Submit button, it would seem that the error
handling would be in the Submit button tag, but it's not. Figure 16-4 shows the error
message and the error that caused it — note the hand cursor on the sent (Submit) button.