王德森

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

在之前写的“首页”,“上一页”,“下一页”,“尾页”功能中,我使用这样的方式获取到action:

      <button type="button" onclick="window.location='topicAction_findAll?page_num=${page_num+1}'">下一页</button>

在写跳转到第几页的功能时,苦于不知道怎样获取到输入框中的值赋给page_num,经过查询,发现这种方法是可行的:

      body中代码:

      <td><input type="text" id="page_id"/></td>

      <td><button type="button" onclick="test()">确定</button></td>

      javascript代码:

      <script type="text/javascript">

      function test(){

          var page = document.getElementById("page_id").value;

          window.location.href="topicAction_findAll?page_num="+page;

      }

      </script>

感谢百度用户的回答!

原文链接:http://zhidao.baidu.com/link?url=lGyat99qicihqa5jpWdseX9tVLdDwsO3CdqXnsTG5o5zxr1i8VdL9ldwyTM06_knHG41P7cHEnn4NMLmqkueAa

posted on 2014-04-13 17:39  王德森  阅读(362)  评论(0)    收藏  举报