一个<select name="page" style="height:15px;">
<c:forEach begin="1" end="${customerList[0].maxPage}"
step="1" var="i">
<option value="${i}">${i}</option>
</c:forEach>
</select> 这样的select,当我点击页码时,就跳到后台一个action里。

解决方案 »

  1.   

    <select onchange="dd(this)" name="page" style="height:15px;">
    <c:forEach begin="1" end="${customerList[0].maxPage}"
    step="1" var="i">
    <option value="${i}">${i}</option>
    </c:forEach>
    </select>function dd(dom) {
        var t = dom.value //你选择的数字
     
    }
      

  2.   

    function dd(dom) {
      var t = dom.value //你选择的数字
      location.href = url//你的链接
    }
      

  3.   

    <select name="page" style="height:15px;" onchange="forward(this.value)">
    <c:forEach begin="1" end="${customerList[0].maxPage}"
    step="1" var="i">
    <option value="${i}">${i}</option>
    </c:forEach>
    </select>function forward(v) {
        window.location = "your.action?currentPage=" + v;
    }
      

  4.   

    <select name="page" id="page" style="height:15px;" onchange="forward(this.value)">
    <c:forEach begin="1" end="${customerList[0].maxPage}"
    step="1" var="i">
    <option value="${i}">${i}</option>
    </c:forEach>
    </select><script type = "text/javascript">
    window.onload = function(){
        var curPage=1;
        var paraPage = parseInt(<%=通过url传递过来的page值%>);
        if(paraPage >0){
            curPage = paraPage;
        }
        document.getElementById("page").value = curPage;
    }
    </script>