paging.jsp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <%@ page language="java" contentType="text/html;charset=UTF-8"
  2. pageEncoding="utf-8" isELIgnored="false"%>
  3. <%
  4. String wdRowCountPerPage = request.getParameter("rowNumPer"); // ("rowCountPerPage")。Lin
  5. System.out.println("wdRowCountPerPage:"+ wdRowCountPerPage);
  6. if (wdRowCountPerPage == null)
  7. wdRowCountPerPage = "10";
  8. request.setAttribute("wdRowCountPerPage", wdRowCountPerPage);
  9. %>
  10. <script type="text/javascript" src="/ss/clip/pagination.js"></script>
  11. <%--
  12. <script src="/jw/js/jquery-1.10.2.js"></script>
  13. --%>
  14. <script type="text/javascript">
  15. if(!wd.pagination.pageForm)
  16. wd.pagination.pageForm = document.getElementsByTagName('Form')[document.getElementsByTagName('Form').length-1];
  17. </script>
  18. <div class="pagination" style="float: right;height: 20px;text-align: center;margin-top: 11px;">
  19. <input type="hidden" name="rowNum" value='${ssPaging.rowNum==null?0:ssPaging.rowNum}'> <%-- name="rowCount"。wdPage.。Lin --%>
  20. <input type="hidden" name="pageCount" value="1">
  21. <input type="hidden" name="rowNumPer" value='${ssPaging.rowNumPer==null?wdRowCountPerPage:ssPaging.rowNumPer}'> <%-- name="rowCountPerPage"。wdPage.。Lin --%>
  22. <script language="JavaScript">
  23. wd.pagination.pageForm.pageCount.value =
  24. Math.round((parseInt(wd.pagination.pageForm.rowNum.value) -1) / <%-- .rowCount. --%>
  25. parseInt(wd.pagination.pageForm.rowNumPer.value) +0.5); <%-- .rowCountPerPage. --%>
  26. </script>
  27. <input type="hidden" name="pageNo" value="${ssPaging.pageNo==null?1:ssPaging.pageNo}"> <%-- name="currentPageNo"。wdPage.。Lin --%>
  28. <span class="page" style="vertical-align: middle;line-height: 20px;display: inline-block;zoom: 1;max-width: 90px;height: 20px;">
  29. 共 <script language="JavaScript">document.write(wd.pagination.pageForm.rowNum.value);</script> 条 <%-- .rowCount. --%>
  30. </span>
  31. <span class="icon-prevPage" style="vertical-align: middle;font-weight: normal;line-height: 20px;position: relative;display: inline-block;zoom: 1;width: 8px;height: 20px;text-align: center;margin-left: 10px;margin-right: 9px;" title="上一页"
  32. onclick="wd.pagination.goPage(parseInt(wd.pagination.pageForm.pageNo.value) -1);"> <%-- .currentPageNo. --%>
  33. </span>
  34. <span class="page" style="vertical-align: middle;line-height: 20px;display: inline-block;zoom: 1;max-width: 90px;height: 20px;">
  35. 第 ${ssPaging.pageNo==null?1:ssPaging.pageNo} / <%-- wdPage.。Lin --%>
  36. <script language="JavaScript">
  37. document.write(wd.pagination.pageForm.pageCount.value=='-Infinity'||wd.pagination.pageForm.pageCount.value==0?1:wd.pagination.pageForm.pageCount.value);
  38. </script>
  39. 页
  40. </span>
  41. <span class="icon-nextPage" style="vertical-align: middle;font-weight: normal;line-height: 20px;position: relative;display: inline-block;zoom: 1;width: 8px;height: 20px;text-align: center;margin-left: 8px;" title="下一页"
  42. onclick="wd.pagination.goPage(parseInt(wd.pagination.pageForm.pageNo.value) +1);"> <%-- .currentPageNo. --%>
  43. </span>
  44. <div style="clear:both"></div>
  45. </div>
  46. <script>
  47. $(function setPageList(){
  48. try{
  49. var a = (wd.pagination.pageForm.pageCount.value=='-Infinity'||wd.pagination.pageForm.pageCount.value==0?1:wd.pagination.pageForm.pageCount.value);
  50. var e= wd.pagination.pageForm.pageNo.value; // .currentPageNo.。Lin
  51. if(a<=5){
  52. for(var i=1;i<=a;i++){
  53. var b = '<input type="submit" class="list-pagenum" name="button" value=" '+i+' " onclick="wd.pagination.goPage('+i+');"/>'
  54. $(".list-pageCount").append(b);
  55. }
  56. $(".list-pageCount input").eq(e-1).addClass("list-ck").siblings().removeClass("list-ck");
  57. }else {
  58. var count = '...<input type="submit" class="list-pagenum" name="button" value=" ' + a + ' " onclick="wd.pagination.goPage(' + a + ');"/>'
  59. var first = '<input type="submit" class="list-pagenum" name="button" value=" ' + 1 + ' " onclick="wd.pagination.goPage(' + 1 + ');"/>...'
  60. if (e < 4) {
  61. for (var i = 1; i <= 5; i++) {
  62. var b = '<input type="submit" class="list-pagenum" name="button" value=" ' + i + ' " onclick="wd.pagination.goPage(' + i + ');"/>'
  63. $(".list-pageCount").append(b);
  64. }
  65. //$(".list-pageCount").append(count);
  66. $(".list-pageCount input").eq(e - 1).addClass("list-ck").siblings().removeClass("list-ck");
  67. } else if (e >= a - 2) {
  68. var z = 4;
  69. //$(".list-pageCount").append(first);
  70. for (var i = a - 4; i <= a; i++) {
  71. var b = '<input type="submit" class="list-pagenum" name="button" value=" ' + i + ' " onclick="wd.pagination.goPage(' + i + ');"/>'
  72. $(".list-pageCount").append(b);
  73. }
  74. $(".list-pageCount input").eq(z - (a - e)).addClass("list-ck 1").siblings().removeClass("list-ck");
  75. } else {
  76. //$(".list-pageCount").append(first);
  77. e = parseInt(e)
  78. for (var i = e - 2; i <= e + 2; i++) {
  79. var b = '<input type="submit" class="list-pagenum " name="button" value=" ' + i + ' " onclick="wd.pagination.goPage(' + i + ');"/>'
  80. $(".list-pageCount").append(b);
  81. }
  82. //$(".list-pageCount").append(count);
  83. $(".list-pageCount input").eq(2).addClass("list-ck 2").siblings().removeClass("list-ck");
  84. }
  85. }
  86. if(e==parseInt(a)&&a>1){
  87. $(".list-Pr span").removeClass("list-subnck");
  88. $(".list-Pl span").addClass("list-subnck");
  89. }else if(e==1&&parseInt(a)>1){
  90. $(".list-Pr span").addClass("list-subnck");
  91. $(".list-Pl span").removeClass("list-subnck");
  92. }else if(parseInt(a)==1){
  93. $(".list-Pr span").removeClass("list-subnck");
  94. $(".list-Pl span").removeClass("list-subnck");
  95. }else{
  96. $(".list-Pr span").addClass("list-subnck");
  97. $(".list-Pl span").addClass("list-subnck");
  98. }
  99. /*$(".list-con input").click(function(){
  100. q=($(this).attr("value"));
  101. if(e==parseInt(a)){
  102. $(".list-Pr span").removeClass("list-subnck");
  103. $(".list-Pl span").addClass("list-subnck");
  104. }else if(e==1&&parseInt(a)>1){
  105. console.log("a="+a);
  106. $(".list-Pr span").addClass("list-subnck");
  107. $(".list-Pl span").removeClass("list-subnck");
  108. }else if(parseInt(a)==1){
  109. console.log(a);
  110. $(".list-Pr span").removeClass("list-subnck");
  111. $(".list-Pl span").removeClass("list-subnck");
  112. }else{
  113. $(".list-Pr span").addClass("list-subnck");
  114. $(".list-Pl span").addClass("list-subnck");
  115. }
  116. });*/
  117. }catch(e){
  118. console.log(e);
  119. }
  120. })
  121. $('#toPage').keydown(function(event) {
  122. if(event.keyCode == 13){
  123. if($("#toPage").val() <= parseInt(wd.pagination.pageForm.pageCount.value) && $("#toPage").val() > 0){
  124. wd.pagination.goPage(this.value);
  125. } else {
  126. alert("请输入范围内的页码");
  127. $("#toPage").val(wd.pagination.pageForm.pageNo.value); // .currentPageNo.。Lin
  128. wd.pagination.goPage(wd.pagination.pageForm.pageNo.value); // .currentPageNo.。Lin
  129. }
  130. }else if (event.keyCode >= 48 && event.keyCode <= 57){
  131. $("#toPage").val(eventPhase);
  132. }else if (event.keyCode >= 96 && event.keyCode <= 105){
  133. $("#toPage").val(eventPhase);
  134. }else if(event.keyCode == 8 || event.keyCode == 46){
  135. $("#toPage").val(eventPhase);
  136. }else{
  137. event.preventDefault();
  138. }
  139. event.preventDefault();
  140. });
  141. $("#changePage").click(function(){
  142. if($("#toPage").val() <= parseInt(wd.pagination.pageForm.pageCount.value) && $("#toPage").val() > 0){
  143. wd.pagination.goPage($("#toPage").val());
  144. } else {
  145. alert("请输入范围内的页码");
  146. $("#toPage").val(wd.pagination.pageForm.pageNo.value); // .currentPageNo.。Lin
  147. wd.pagination.goPage(wd.pagination.pageForm.pageNo.value); // .currentPageNo.。Lin
  148. }
  149. });
  150. </script>