EN
Este contenido no se encuentra disponible en su idioma, pero aquí tiene la versión en inglés.

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.

HTML 4.01 Specification, Section 17.4

 

Syntax

HTML<element value="p" ... >
JavaScript

p = object.value

 

Property values

Type: String

The value of a control object which is passed as a name/value pair to the server, when the control object is submitted.

Standards information

Remarks

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

input type=checkbox The selected value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
input type=file The value, a file name, typed by the user into the control. Unlike other controls, this value is read-only.
input type=hidden The value that the control submits when the form is submitted.
input type=password The default value. The control displays this value when it is first created and when the user clicks the reset button.
input type=radio The selected value. The control submits this value only if the user has selected the control. Otherwise, the control submits no value.
input type=reset The button label. If not set, the label defaults to Reset.
input type=submit The button label. If not set, the label defaults to Submit.
input type=text The default value. The control displays this value when it is first created and when the user clicks the reset button.
input type=range No value is assigned by default. The range control is in indeterminate mode.
input type=number The default value. The control displays this value when it is first created and when the user clicks the reset button.
input type=email The default value. The control displays this value when it is first created and when the user clicks the reset button.
input type=url The default value. The control displays this value when it is first created and when the user clicks the reset button.
input type=tel The 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.

Note  Though the 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 name="textbox" size="15" type="text" value=""> 

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


<script type="text/javascript">
function detectEntry()
{
    alert("Your name is " + textbox.value)
}
</script>


See also

input
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url

 

 

Mostrar:
© 2014 Microsoft