please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Element.name Property

Name

Element.name Property---the name of a form element

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

element.name

Description

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, then the data for that element cannot be meaningfully 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, then 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," then they are available in JavaScript as elements of the array order.options[].

Bugs

In Navigator 2.0, when multiple form elements are given the same name and placed in an array, they will only be placed in the array in the expected source order if they all define an event handler, even a dummy event handler that does nothing. If none of the elements define event-handlers, then they will be inserted into the array in reverse order. If some define event handlers and others don't, the order will be less predictable. In cases where array order actually matters, the workaround to this bug is to define dummy event handlers as needed.

See Also

"Element"


Previous Home Next
Element.length Book Index Element.onblur()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/JAVA/SCRIPT/definitive/refp_106.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/12/23 12:56,
TOP NEW HELP FIND: 
3.145.152.49:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/JAVA/SCRIPT/definitive/refp_106.htm"> [Chapter 21] Reference: Element.name</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .