jstl 写的分页
<span id='pagina'>
<c:if test='${pager.curPageNO == 1}'>
<a href='javascript:void(0);' onclick="javaScript:alert('当前已经是首页!');">首页</a>
</c:if>
<c:if test='${pager.curPageNO != 1}'>
<a href='javascript:void(0);' onclick="tye_1(1)">首页</a>
</c:if>
<c:if test='${pager.curPageNO == 1}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是第一页!');">上一页</a>
</c:if>
<c:if test='${pager.curPageNO != 1}'>
<a href='javascript:void(0);' onclick="tye_1(${pager.curPageNO - 1})">上一页</a>
</c:if>
<c:choose>
<c:when test="${pager.totalpage <=11 }">
<c:forEach begin="1" end="${pager.totalpage}" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
</c:when>
<c:otherwise>
<c:choose>
<c:when test="${pager.curPageNO -5 <=1 && (pager.curPageNO +5) >=pager.totalpage}">
<c:forEach begin="1" end="${pager.totalpage }" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
</c:when>
<c:when test="${pager.curPageNO -5 >1 && (pager.curPageNO +5) >= pager.totalpage}">
<c:forEach begin="${pager.curPageNO -5}" end="${pager.totalpage}" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
</c:when>
<c:when test="${pager.curPageNO -5 >=1 && (pager.curPageNO +5) < pager.totalpage}">
<c:forEach begin="${pager.curPageNO -5}" end="${pager.curPageNO + 5}" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
</c:when>
<c:when test="${pager.curPageNO -5 <1 && (pager.curPageNO +5) < pager.totalpage}">
<c:forEach begin="1" end="11" var="i" >
<a href='javascript:void(0);' name='number1'>${i}</a>
</c:forEach>
</c:when>
</c:choose>
</c:otherwise>
</c:choose>
<c:if test='${pager.curPageNO == pager.totalpage}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是最后一页!');">下一页</a>
</c:if>
<c:if test='${pager.curPageNO != pager.totalpage}'>
<c:if test='${pager.curPageNO <= pager.totalpage}'>
<a href='javascript:void(0);' onclick="tye_1(${pager.curPageNO + 1})">下一页</a>
</c:if>
<c:if test='${pager.curPageNO > pager.totalpage}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是最后一页!');">下一页</a>
</c:if>
</c:if>
<c:if test='${pager.curPageNO == pager.totalpage}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是尾页!');">尾页</a>
</c:if>
<c:if test='${pager.curPageNO != pager.totalpage}'>
<c:if test='${pager.curPageNO <= pager.totalpage}'>
<a href='javascript:void(0);' onclick="tye_1(${pager.totalpage})">尾页</a>
</c:if>
<c:if test='${pager.curPageNO > pager.totalpage}'>
<a href='javascript:void(0);' onclick="javaScript:alert('已经是尾页!');">尾页</a>
</c:if>
</c:if>
</span>
function tye_1(pageno){
if(parseInt('${main}') == 0){ //个人中心首页显示
$("#tab_31").load("/personalCenter.do?dayAccountList&status=2&main=0&pageNo="+pageno+"&pageIndex=${pageIndex}");
}else{
var status=parseInt('${status}');
if(!isNaN(parseInt(status))){
if(status == 0){ //待支付
$("#tab_2").load("/personalCenter.do?dayAccountList&pageNo="+pageno+"&ispay=0&status=0");
scroll(0,0);
}else if(status == 99){ //查找全部
$("#tab_1").load("/personalCenter.do?dayAccountList&pageNo="+pageno);
scroll(0,0);
}else if(status == 4){ //终止
$("#tab_4").load("/personalCenter.do?dayAccountList&status="+status+"&pageNo="+pageno);
scroll(0,0);
}else if(status == 2){ //交易
$("#tab_31").load("/personalCenter.do?dayAccountList&status="+status+"&pageNo="+pageno+"&pageIndex=${pageIndex}");
if("${pageIndex}"==2){
scroll(0,450);
}else{
scroll(0,0);
}
}
}
}
}
共同学习,写下你的评论
评论加载中...
作者其他优质文章