<form>
<select id='sel' name='sel'>
<option value='1'>one</option>
<option value='2'>two</option>
<option value='3'>three</option>
</select>
<input type='button' value='see selected' onclick='getValue();'>
<script>
function getValue()
{
var obj=document.all.sel;
if (obj==null) return false;
var index=obj.selectedIndex;
var value=obj.options[index].value;
alert("the value you select is : "+value);
return value;
}
</script>
</form>
<select id='sel' name='sel'>
<option value='1'>one</option>
<option value='2'>two</option>
<option value='3'>three</option>
</select>
<input type='button' value='see selected' onclick='getValue();'>
<script>
function getValue()
{
var obj=document.all.sel;
if (obj==null) return false;
var index=obj.selectedIndex;
var value=obj.options[index].value;
alert("the value you select is : "+value);
return value;
}
</script>
</form>
但在我代码里就不行。。
郁闷了