日期:2014-05-18  浏览次数:20691 次

javaScript分页问题
点击数字第三页后,翻页,但是不显示第四页的页码。用上一页,下一页可以正常翻页。代码如下:

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script type="text/javascript">
//<!--
$(function(){
var scroll = "${param.scroll}";
if(scroll == "true"){
$('body,html').scrollTop(0);
}
});

function toPage(){
var total = Number("${pagination.totalPage}");
var p = $.trim($("#pageNumText").val());
p = Number(p);
if(!p || isNaN(p) || p>total){
return;
}
if(!/^[0-9]*[1-9][0-9]*$/.test(p)){
return;
}
clickPageNum('${pagination.params}','p='+p);
}
//-->
</script>

<div class="page-bottom" id="paginationDivId" style="width:auto;">
 <div class="get-page" style="float: right; width: auto; margin-left: 10px;">
<span>第</span><input type="text" id="pageNumText" class="get_input" style="width:20px;" ><span>页</span>
<input type="button" value="确定" class="btn" style="cursor: pointer;" onclick="toPage();" style="margin-right:0px;">
</div>
<div style="width: auto; float: right;" class="fenye_2">
     <span class="disabled">共
     <c:choose>
            <c:when test="${(pagination == null) || (pagination.totalCount == null)}">0</c:when>
            <c:otherwise>${pagination.totalCount }</c:otherwise>
 </c:choose>
             条</span>
<c:if test="${pagination.totalPage eq 1}">
<span class="disabled">首页</span>
<span class="disabled">上一页</span>
<span class="current">1</span>
<span class="disabled">下一页</span>
<span class="disabled">末页</span>
</c:if>

<c:if test="${pagination.totalPage > 1 and pagination.totalPage < 7}">
<c:if test="${pagination.page eq 1}">
<span class="disabled">首页</span>
<span class="disabled">上一页</span>
</c:if>
<c:if test="${pagination.page != 1}">
<span>
<a onclick="clickPageNum('${pagination.params}','p=1')" href="javascript:void(0)" title="首页">首页</a>
</span>
<span>
<a onclick="clickPageNum('${pagination.params}','p=${pagination.page-1}')" href="javascript:void(0)" title="上一页">上一页</a>
</span>
</c:if>
<c:forEach var="i" begin="1" end="${pagination.totalPage}">
<c:if test="${pagination.page eq i}">
<span class="current">
${i}
</span>
</c:if>
<c:if test="${pagination.page ne i}">
<span>
<a onclick="clickPageNum('${pagination.params}','p=${i}')" href=