`
zhengshuangxi1226
  • 浏览: 48474 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

页面分页

阅读更多
<table width="100%">
<tr>
<td width="218" align="left" style="padding-top:5px;">总页数:<font style="color:#FF0000;"><%=pagination.getTotalPage() %></font>&nbsp;页 总记录数:<font style="color:#FF0000;"><%=StringTools.isEmpty(total)? 0 : total %></font>&nbsp;条</td>
<td style="padding-top:5px;">
<div id="pagelist" class="scott2 fj">
<%
int startPage = pagination.getPageNo(); //开始页
int endPage = pagination.getPageNo() + 4;//结束页
int lastStartPage = pagination.getTotalPage() - 1 ;
int lastEndPage = pagination.getTotalPage();
boolean forlast = true;
if( startPage - 2 > 0)
{
endPage = pagination.getPageNo() + 2;
startPage = startPage - 2;
}
else
{
endPage = pagination.getPageNo() + 5 - startPage;
startPage =  startPage - startPage / 2;
}

if ( endPage  > lastEndPage - 2)
{
forlast = false;
startPage = lastEndPage - 6  ;
endPage =lastEndPage;
}
if (startPage < 1)
{
startPage = 1;
}
if (pagination.getPageNo() == 1)
    {
    %><span class="current">|&lt;&lt;</span><%
    }
    else
    {
    %><span><a href="<%=urlPage %>1" >|&lt;&lt;</a></span><%
    }
for ( int i = startPage; i <= endPage ; i++)
{
%><span <%
if (pagination.getPageNo() == i )
{
%>class="current"><%=i%><%
}
else
{
%>><a href="<%=urlPage %><%=i%>"><%=i%></a><%
}
%></span><%
}
if (endPage + 1  <  lastStartPage )
{
%>...<%

if (forlast)
{
for (int i = lastStartPage ; i <= lastEndPage ; i++)
{
%><a href="<%=urlPage %><%=i%>"><%=i%></a><%
        }
        }
        if (pagination.getPageNo() == pagination.getTotalPage())
        {
   %><span class="current">&gt;&gt;|</span><%
    }
    else
    {
   %><span><a href="<%=urlPage %><%=pagination.getTotalPage() %>">&gt;&gt;|</a></span><%
    }
%>
</div>
</td>
<td width="48" style="border-top: 0px dotted rgb(204, 204, 204); padding-top:5px;"><input id="pageNum" name="pageNum" onkeyup="value=value.replace(/[^\d]/g,'')" type="text" style="width: 35px; height: 22px; text-align: center; line-height: 22px; border:#AACDE9 1px solid ; m-top:15px;"/></td>
<td align="right" style="padding:0; border-top: 0px dotted rgb(204, 204, 204);padding-top:5px;"><input type="button" style="color: rgb(15, 112, 145); background: url(&quot;<%=path %>/www/marketingcenter/images/go.gif&quot;) no-repeat scroll center top transparent; height: 22px; width: 22px; font-size: 12px; cursor: pointer;" onclick="getPageNum('<%=urlPage %>','<%=lastEndPage%>');" value="GO"/></td>
</tr>
</table>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics