分頁欄 jsp 代碼

來源:互聯網
上載者:User

************************************************************************
分頁的代碼:

--------------CSS樣式--------------
<style type="text/css"><br />body,td,th {<br />font-family: Arial, Helvetica, sans-serif;<br />font-size: 12px;<br />color: #333;<br />}<br />body {<br />margin-left: 0px;<br />margin-top: 0px;<br />margin-right: 0px;<br />margin-bottom: 0px;<br />}<br />body table tr td table tr {<br />background-color: #FFF;<br />}<br />.pages {<br />padding-bottom: 2px;<br />padding-left: 0px;<br />padding-right: 0px;<br />padding-top: 2px;<br />float:right;<br />}<br />.pages a {<br />border-bottom: 1px solid;<br />border-left: 1px solid;<br />padding-bottom: 0px;<br />line-height: 20px;<br />padding-left: 6px;<br />padding-right: 6px;<br />float: left;<br />height: 20px;<br />overflow: hidden;<br />border-top: 1px solid;<br />margin-right: 2px;<br />border-right: 1px solid;<br />padding-top: 0px;<br />border-bottom-color: #e6e7e1;<br />background-color: #fff;<br />border-top-color: #e6e7e1;<br />color: #09c;<br />border-right-color: #e6e7e1;<br />border-left-color: #e6e7e1<br />}<br />.pages a:hover {<br />border-bottom-color: #09c;<br />border-top-color: #09c;<br />border-right-color: #09c;<br />border-left-color: #09c<br />}<br />.pages a:visited{<br />text-decoration:none;<br />}<br />a:link {<br />text-decoration: none;<br />}<br />a:visited {<br />text-decoration: none;<br />}<br />a:hover {<br />text-decoration: underline;<br />}<br />a:active {<br />text-decoration: none;<br />}<br />.topindex{<br />padding-top:10px;<br />padding-bottom:10px;<br />text-align:center;<br />}<br />.topindex span{<br />margin-left:10px;<br />margin-right:10px;<br />}<br />.topindex span a:link{<br />color:#810081;<br />}<br /></style>

--------------簡單分頁--------------

<div class="pages"></p><p> <a href="showposttable.jsp?currentPage=1" mce_href="showposttable.jsp?currentPage=1">首頁</a> </p><p> <%if(currentPage>1){%><br /> <a href="showposttable.jsp?currentPage=<%=currentPage-1%>" >上一頁</a><br /> <%}%></p><p> <a href="showposttable.jsp?currentPage=<%=currentPage%>" style="background-color:#0099CC;color:#FFF"><%=currentPage%></a></p><p> <%if(currentPage<totalPages){%><br /> <a href="showposttable.jsp?currentPage=<%=currentPage+1%>">下一頁</a><br /> <%}%></p><p> <a href="showposttable.jsp?currentPage=<%=totalPages%>">末頁</a></p><p> </div>

--------------複雜分頁--------------
<div class="pages"></p><p> <%if(totalPages<=10){ %><br /> <a href="showposttable.jsp?currentPage=1" mce_href="showposttable.jsp?currentPage=1">首頁</a></p><p> <%if(currentPage>1){%><br /> <a href="showposttable.jsp?currentPage=<%=currentPage-1%>"><</a><br /> <%}%></p><p> <%for(int i=1;i<=totalPages;i++) {%><br /> <%if(i==currentPage){%><br /> <a href="showposttable.jsp?currentPage=<%=i %>" style="background-color:#0099CC;color:#FFF"><%=i %></a><br /> <%}else{ %><br /> <a href="showposttable.jsp?currentPage=<%=i %>"><%=i %></a><br /> <%} %><br /> <%} %></p><p> <%if(currentPage<totalPages){%><br /> <a href="showposttable.jsp?currentPage=<%=currentPage+1%>">></a><br /> <%}%></p><p> <a href="showposttable.jsp?currentPage=<%=totalPages %>">尾頁</a><br /> <%}<br /> else{%></p><p> <a href="showposttable.jsp?currentPage=1" mce_href="showposttable.jsp?currentPage=1">首頁</a></p><p> <%if(currentPage>1){%><br /> <a href="showposttable.jsp?currentPage=<%=currentPage-1%>"><</a><br /> <%}%></p><p> <%if(currentPage>=1&&currentPage<=3) {%><br /> <%for(int i=1;i<=10;i++) {%><br /> <%if(i==currentPage){%><br /> <a href="showposttable.jsp?currentPage=<%=i %>" style="background-color:#0099CC;color:#FFF"><%=i %></a><br /> <%}else{ %><br /> <a href="showposttable.jsp?currentPage=<%=i %>"><%=i %></a><br /> <%} %><br /> <%} %><br /> <%} %></p><p> <%if(currentPage>=4&&currentPage<=totalPages-7){ %><br /> <%for(int i=currentPage-2;i<=currentPage+7;i++) {%><br /> <%if(i==currentPage){%><br /> <a href="showposttable.jsp?currentPage=<%=i %>" style="background-color:#0099CC;color:#FFF"><%=i %></a><br /> <%}else{ %><br /> <a href="showposttable.jsp?currentPage=<%=i %>"><%=i %></a><br /> <%} %><br /> <%} %><br /> <%} %></p><p> <%if(currentPage>=totalPages-6&&currentPage<=totalPages){ %><br /> <%for(int i=totalPages-9;i<=totalPages;i++) {%><br /> <%if(i==currentPage){%><br /> <a href="showposttable.jsp?currentPage=<%=i %>" style="background-color:#0099CC;color:#FFF"><%=i %></a><br /> <%}else{ %><br /> <a href="showposttable.jsp?currentPage=<%=i %>"><%=i %></a><br /> <%} %><br /> <%} %><br /> <% }%></p><p> <%if(currentPage<totalPages){%><br /> <a href="showposttable.jsp?currentPage=<%=currentPage+1%>">></a><br /> <%}%></p><p> <a href="showposttable.jsp?currentPage=<%=totalPages %>">尾頁</a></p><p> <%}%></p><p> </div><br />

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.