HTML and CSS Reference
In-Depth Information
Figure 11.9
The form from Example 11.4 using both the
name
and
id
attribute.
Figure 11.10
The PHP program responds. Note the name/value pair after the ? in
the Location box.
The
forms
[]
Array.
Because the document contains forms, the
form
object is a prop-
erty of the
document
object
.
Every time you create a form in a given document, the
browser creates a unique form object and assigns it as an element of an array, called the
forms[]
array. The index value of the array, starting at 0, corresponds to the order in
which the form occurs in the document; the first form is assigned to
forms[0]
, and each
successive form would get the next index value. When accessing a form from JavaScript,
the first form to appear in the page would be referred to as
document.forms[0]
and the
next form
document.forms[1]
, and so on. See Figure 11.11.