获得select控件的选择值
方法一:根据ID
1<select id="abc" onchange="change(this)">
2 <option value='1'>1</option>
3 <option value='2'>2</option>
4 <option value='3'>3</option>
5</select>
6
7<script type="text/javascript">
8 function change(obj)
9 {
10 var selValue=(obj.options[obj.selectedIndex]).value;//获得选中值
11 alert(selValue);
12 }
13</script>
14
2 <option value='1'>1</option>
3 <option value='2'>2</option>
4 <option value='3'>3</option>
5</select>
6
7<script type="text/javascript">
8 function change(obj)
9 {
10 var selValue=(obj.options[obj.selectedIndex]).value;//获得选中值
11 alert(selValue);
12 }
13</script>
14
方法二:借助FORM
1<form id='form1'>
2<select id='abc' onchange="change()">
3<option value='1'>1</option>
4<option value='2'>2</option>
5<option value='3'>3</option>
6</select>
7</form>
8
9<SCRIPT LANGUAGE="JavaScript">
10 function change()
11 {
12 var selValue=this.form1.abc.value;
13 alert(selValue);
14 }
15</SCRIPT>
2<select id='abc' onchange="change()">
3<option value='1'>1</option>
4<option value='2'>2</option>
5<option value='3'>3</option>
6</select>
7</form>
8
9<SCRIPT LANGUAGE="JavaScript">
10 function change()
11 {
12 var selValue=this.form1.abc.value;
13 alert(selValue);
14 }
15</SCRIPT>