VALUE Attribute | value Property

Internet Development Index

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... >
Scriptingobject.value [ = sValue ]

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.

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

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 input type=password object's value property text is always displayed with each character's text hidden, such as with an asterisk (*) placeholder.

Note  Though the input type=password?B>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 Non-Microsoft link.

Applies To

INPUT type=password, INPUT type=text

See Also

input