获取下拉框的值

<select id="orderStatus" name="stats">

  <option <c:if test="${order.rStatus eq 5}">selected</c:if> value="5">退款中</option>
  <option <c:if test="${order.rStatus eq 6}">selected</c:if> value="6">已退货</option>
</select>

 

1、当页面只有一个select 控件时:

var stats = $("select").val();

2、根据控件id 获取:

var obj = document.getElementById("orderStatus");
var index = obj.selectedIndex;
var stats = obj.options[index].value;

posted @ 2016-07-26 13:50  zhoudingzhao  阅读(234)  评论(0编辑  收藏  举报