Properties


VALUE Attribute | value Property

Sets or retrieves the displayed value for the control object. This value is returned to the server when the control object is submitted.

Syntax

HTML<ELEMENT VALUE = sValue... >
Scripting[ sValue = ] object.value

Possible Values

sValueString that specifies or receives the value of a control object which is passed as a name/value pair to the server, when the control object is submitted.

The property is read/write. The property has no default value for all objects with the following exceptions:

INPUT type=checkboxon
INPUT type=resetReset
INPUT type=submitSubmit Query

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Remarks

The purpose of the value property depends on the type of control as described in the following table.

input type=checkboxThe selected value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
input type=fileThe value, a file name, typed by the user into the control. Unlike other controls, this value is read-only.
input type=hiddenThe value that the control submits when the form is submitted.
input type=passwordThe default value. The control displays this value when it is first created and when the user clicks the reset button.
input type=radioThe selected value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
input type=resetThe button label. If not set, the label defaults to Reset.
input type=submitThe button label. If not set, the label defaults to Submit.
input type=textThe default value. The control displays this value when it is first created and when the user clicks the reset button.

The value property of the input type=file object returns only the file name and not the path of the file to machines outside the local machine security zone. For more information on security zones, see About URL Security Zones.

The initial setting of the value property is the initial display value for the control object. The user may edit the value text prior to submission of a control object's content. If the control object is reset using the input type=reset control object, the initial value is restored.

The value property text of the input type=password object is always displayed with each character's text hidden, such as with an asterisk (*) placeholder.

Note  Though the input type=password value property display text is hidden, data is passed to the server in clear text, and may be read by anyone with access to the network.

Examples

This example uses the input type=text element to create an empty text control that can contain 15 characters without requiring the user to scroll to read all of the text.

<INPUT TYPE=text VALUE="" NAME="textbox" SIZE=15>

This example uses script to detect the content of the text box and display it in a dialog box.

<SCRIPT>
function detectEntry()
{
    alert("Your name is " + textbox.value)
}
</SCRIPT>

Standards Information

This property is defined in HTML 3.2 World Wide Web link.

Applies To

INPUT, INPUT type=checkbox, INPUT type=password, INPUT type=text, INPUT type=file, INPUT type=hidden, INPUT type=button, INPUT type=radio, INPUT type=reset, INPUT type=submit

See Also

input
Tags :


Community Content

Cornan The Iowan
multiple checkboxes with same name property
If more than one input type=checkbox element with the same name property is present in a form, a unique value property (that is, other than "on") can be assigned to each element to generate unique name / value pairs for the receiving receiving technology to interpret.

These might (for example) be available as a collection under a "form" collection or object, where they could be iterated for processing.
Tags :

Page view tracker