NAME Attribute | name Property | Internet Development Index |
Sets or retrieves the name of the object.
This property now applies to the
Syntax
HTML <ELEMENT NAME = sName... > Scripting object.name [ = sName ]
Possible Values
sName String that specifies or receives the name. The property is read/write. The property has no default value.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.
Remarks
When submitting a form, use the name property to bind the value of the control. The name is not the value displayed for the input type=button, input type=reset, and input type=submit input types. The internally stored value, not the displayed value, is the one submitted with the form.
Microsoft JScript® allows the name to be changed at run time. This does not cause the name in the programming model to change in the collection of elements, but it does change the name used for submitting elements.
The NAME attribute cannot be set at run time on elements dynamically created with the createElement method. To create an element with a name attribute, include the attribute and value when using the createElement method.
Examples
The following example shows how to set the NAME attribute on a dynamically created A element.
var oAnchor = document.createElement("<A NAME='AnchorName'></A>");
Standards Information
This property is defined in HTML 3.2 and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To