EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

value attribute | value property

Sets or retrieves the value which is returned to the server when the form control is submitted.

HTML 4.01 Specification, Section 17.6.1

 

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 an object is submitted.

Standards information

Remarks

Individual control objects return a value to the server only if they have been selected by the user.

You may pass server-friendly data directly to the server without confusing the user. The user sees only the innerText displayed, and not the value.

Examples

This example sets the value for each option element to a supply stock number.



<script type="text/javascript">
function fnShowText(){
   /* Use the selectedIndex property of the select control
   to retrieve the text from the options collection. */
   
   var sText = "Stock Number = " + oSel.options(oSel.selectedIndex).value;
   alert(sText);
}
</script>
<select id="oSel" onchange="fnShowText()"> 
  <option value="STK#45">Item One - Basketball</option>
  <option value="STK#347">Item Two - Baseball</option>  
  <option value="STK#67">Item Three - Hockey Puck</option>
</select> 


See also

option
select

 

 

표시:
© 2014 Microsoft