NAME Attribute | name Property

DHTML, HTML, & CSS

NAME Attribute | name Property


Sets or retrieves the name of the control, bookmark, or application.

Syntax

HTML<ELEMENT NAME = sName ... >
Scriptingobject.name [ = sName ]

Possible Values

sNameString that specifies the name.

The property is read/write with no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

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 button, reset, and submit input types. The internally stored value, not the displayed value, is the one submitted with the form.

Microsoft® JScript® (compatible with ECMA 262 language specification) 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.

In Internet Explorer 5, the name property cannot be set at run time on anchor objects dynamically created with the createElement method. To create an anchor with a NAME attribute, include the attribute and value when using the createElement method, or use the innerHTML property.

Example

This example sets the NAME attribute on a dynamically created anchor.
var oAnchor = document.createElement("<A NAME='AnchorName'></A>");

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, APPLET, BUTTON, FORM, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, MAP, OBJECT, PARAM, RT, RUBY, SELECT, TEXTAREA

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.