HTML and CSS Reference
In-Depth Information
9.2.8. The Event Attributes
As for most other elements in a document, the <form> tag honors the
standard mouse and keyboard event-related attributes the compliant
browser will recognize. We describe the majority of these attributes in
detail in Chapter 12 . [ JavaScript Event Handlers, 12.3.3 ]
Forms have two special event-related attributes: onSubmit and onReset .
The value of each event attribute isenclosed in quotation marksone or a
sequence of semicolon-separated JavaScript expressions, methods, and
function references. With onSubmit , the browser executes these com-
mands before it actually submits the form's data to the server or sends
it to an email address.
You may use the onSubmit event for a variety of effects. The most pop-
ular is for a client-side forms-verification program that scans the form
data and prompts the user to complete one or more missing elements.
Another popular and much simpler use is to inform users when a mailto
URL form is being processed via email.
The onReset attribute is used just like the onSubmit attribute, except that
the associated program code is executed only if the user presses a Re-
set button in the form.
Search WWH ::

Custom Search