下拉框 取值汇总

<select id="HostAccount" name="" onchange="HostClient("ORACLE")" style="margin-right: 12px; width: 145px; color: rgb(0, 0, 0);">

<option value="null" style="color:#999" acctype="0">用户填写</option>
<option value="532" style="color:#000" acctype="1" selected="selected">system</option>
<option value="552" style="color:#000" acctype="1">whj</option>

</select>



var acc = $("#HostAccount").val(); //532
var accname = $("#HostAccount option:selected").text();//system
var acctype = $("#HostAccount option:selected").attr("acctype");//1


你可能感兴趣的:(JavaScript)