Availability
JavaScript 1.0
Synopsis
input.nameDescription
name is a read-only string property of every form
element. The value of this property is set by the
name attributes of the HTML
<input> tag that defines the form element.
The name of a form element is used for two purposes. First, it is
used when the form is submitted. Data for each element in the form is
usually submitted in the format:
name=value
where name and
value are encoded as necessary for
transmission. If a name is not specified for a form element, the data
for that element cannot be submitted to a web server.
The second use of the name property is to refer to
a form element in JavaScript code. The name of an element becomes a
property of the form that contains the element. The value of this
property is a reference to the element. For example, if
address is a form that contains a text input
element with the name zip,
address.zip refers to that text input element.
With Radio and Checkbox form elements, it is common to define more
than one related object, each of which have the same
name property. In this case, data is submitted to
the server with this format:
name=value1,value2,...,valuen
Similarly, in JavaScript, each of the elements that shares a name
becomes an element of an array with that name. Thus, if four Checkbox
objects in the form order share the name
options, they are available in JavaScript as
elements of the array order.options[].