HTML and CSS Reference
In-Depth Information
EXPLANATION
4
If
false
is returned, the form is stopped, and will not be submitted.
5
The HTML form, called
mailchk
, starts here. The
onSubmit
event will be triggered
when the user clicks the submit button on line 7.
6
The form's input type is a textbox named
address
that will hold up to 60 characters.
7
When the user clicks the submit button, the
onSubmit
handler on line 5 is trig-
gered. It invokes the handler function, called
email
, and passes a reference to the
form as an argument. See Figures 11.48 and 11.49.
Figure 11.48
The user enters a valid e-mail address.
Figure 11.49
The user enters an invalid e-mail address. A dot is missing in the address.
Checking Password Fields.
There are a number of checks made on password
entries. Does it have the right number of characters? Does it contain one numeric char-
acter? Can it contain upper and lowercase characters? The following example is a simple
validation routine to check for alphanumeric characters and that the number of charac-
ters in the password field is not less than six.