Form ObjectNameForm Object---an HTML input formSynopsis
document.form_name document.forms[form_number] document.forms.length Properties
Methods
Event Handlers
HTML SyntaxA Form object is created with a standard HTML <FORM> tag. JavaScript adds the optional onReset and onSubmit event-handler attributes to this tag. The form contains any input elements created with the <INPUT> tag between <FORM> and </FORM>.
<FORM [ NAME="form_name" ] used to name the form in JavaScript [ TARGET="window_name" ] the name of the window for responses [ ACTION="url" ] the URL to which the form is submitted [ METHOD=(GET|POST) ] the method of form submission [ ENCTYPE="encoding" ] how the form data is encoded [ onReset="handler" ] a handler invoked when form is reset [ onSubmit="handler" ] a handler invoked when form is submitted > form text and <INPUT> tags go here </FORM> DescriptionThe Form object represents an HTML <FORM> in a document. Each form in a document is represented as an element of the Document.forms[] array. Named forms are also represented by the form_name property of their document, where form_name is the name specified in the NAME attribute of the <FORM> tag. The elements of a form (buttons, input fields, check boxes, and so on) are collected in the Form.elements[] array. Named elements, like named forms, can also be referenced directly by name--the element name is used as a property name of the Form object. Thus, to refer to a Text object element named "phone" within a form named "questionnaire," you might use the JavaScript expression:
document.questionnaire.phone See the descriptions of the Form properties and methods for more information about this object. |
|