码迷,mamicode.com
首页 > Web开发 > 详细

HTML静态分页(形如:首页,上一页,下一页,尾页)

时间:2014-06-16 00:13:39      阅读:1680      评论:0      收藏:0      [点我收藏+]

标签:class   java   tar   ext   get   数据   

在HTML中有时候我们会用到静态分页,一次拿回一定量的数据结果条目,我们会以形如:第2页,共12页  首页 上一页 下一页 尾页 的方式进行静态分页,以下是该种静态分页的代码,供兄弟姐妹们参考。 

<div class="page"> <!-- a href="tosearch.jsp" target="_blank" class="blue">更多</a -->

<SCRIPT type="text/javascript">

function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){   if(_nPageCount == null || _nPageCount<1){     return;   }   var nCurrIndex = _nCurrIndex || 0;   var pre,next,first,last;   if(_nPageCount==1){   first=‘<span class="blue">首页</span>&nbsp;‘; pre=‘<span class="blue">上一页</span>&nbsp;‘; next=‘<span class="blue">下一页</span>&nbsp;‘; last=‘<span class="blue">尾页</span>&nbsp;‘; }else{  if(_nCurrIndex==0){      pre=‘<span class="blue">上一页</span>&nbsp;‘;      first=‘<span class="blue">首页</span>&nbsp;‘; next=‘<a class="blue" href="‘+_sPageName+‘_‘ +(nCurrIndex+1)+‘.‘+_sPageExt+‘">下一页</a>&nbsp;‘;      last=‘<a class="blue" href="‘+_sPageName+‘_‘ + (_nPageCount-1)+‘.‘+_sPageExt+‘">尾页</a>&nbsp;‘; } else{  if(_nCurrIndex==1){    first=‘<a class="blue" href="‘+_sPageName+‘.‘+_sPageExt+‘">首页</a>&nbsp;‘; pre=‘<a class="blue" href="‘+_sPageName+‘.‘+_sPageExt+‘">上一页</a>&nbsp;‘;    if(_nPageCount==2){ next=‘<span class="blue">下一页</span>&nbsp;‘; last=‘<span class="blue">尾页</span>&nbsp;‘; } else{ next=‘<a class="blue" href="‘+_sPageName+‘_‘ + (nCurrIndex+1)+‘.‘+_sPageExt+‘">下一页</a>&nbsp;‘; last=‘<a class="blue" href="‘+_sPageName+‘_‘ + (_nPageCount-1)+‘.‘+_sPageExt+‘">尾页</a>&nbsp;‘; }} else{    first=‘<a class="blue" href="‘+_sPageName+‘.‘+_sPageExt+‘">首页</a>&nbsp;‘; pre=‘<a class="blue" href="‘+_sPageName+‘_‘+(nCurrIndex -1)+‘.‘+_sPageExt+‘">上一页</a>&nbsp;‘; if(nCurrIndex+1==_nPageCount){ next=‘<span class="blue">下一页</span>&nbsp;‘; last=‘<span class="blue">尾页</span>&nbsp;‘; } else{ next=‘<a class="blue" href="‘+_sPageName+‘_‘ + (nCurrIndex+1)+‘.‘+_sPageExt+‘">下一页</a>&nbsp;‘; last=‘<a class="blue" href="‘+_sPageName+‘_‘ + (_nPageCount-1)+‘.‘+_sPageExt+‘">尾页</a>&nbsp;‘; } }

}

}

 

document.write("第"+(nCurrIndex+1)+"页,共"+_nPageCount+"页&nbsp;&nbsp;"+first+pre+next+last); }

createPageHTML(${PAGE_COUNT}, ${PAGE_INDEX}, "${PAGE_NAME}", "${PAGE_EXT}");   </SCRIPT> </div>

HTML静态分页(形如:首页,上一页,下一页,尾页),布布扣,bubuko.com

HTML静态分页(形如:首页,上一页,下一页,尾页)

标签:class   java   tar   ext   get   数据   

原文地址:http://www.cnblogs.com/dreamzhiya/p/3784223.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!