如果想获得下拉列表框的value,需要通过这种方式
<script language="javascript">
function selectInput(choose)
{
alert(choose.value); //this.value
alert(document.all.month.value);//这个是另外种获得下拉列表框的值
}
</script>
<select name="month" onchange="selectInput(this)">
<option value="01">January</option>
<option value="02">February</option>
<option value="03" selected=”selected”>March</option>
<option value="04">April</option>
</select>
如果需要获取他的text,首先需要获得取下标值,再通过下标值来获取text
<script language="javascript">
function selectInput(choose)
{
//首先获得下标,再取获得对应的text
alert(choose.options[choose.selectedIndex].text);
}
</script>
<select name="Month" onchange="selectInput(this)">
<option value="01">January</option>
<option value="02" selected=”selected”>February</option>
<option value="03">March</option>
<option value="04">April</option>
</select>