<select class="select_w220" id="usertype" name="userRoleId" style="width: 204px; height: 24x;" onchange = getOptionIdOrValue();>
<option value="">--请选择--</option>
<option id="1" value="1">--1--</option>
<option id="2" value="2">--2--</option>
</select>
js方法
function getOptionIdOrValue(){
获取option ID
var selectIndex =document.getElementById("usertype").selectedIndex;
var activeName_value =document.getElementById("usertype").options[selectIndex].id;
alert(activeName_value);
获取option value
var selectIndex =document.getElementById("usertype").selectedIndex;
var activeName_value =document.getElementById("usertype").options[selectIndex].value;
alert(activeName_value);
}