javascript下写的一个分页模板

这几天刚好在用JAVA开发一个WEB应用系统,在前端的设计中涉及到分页问题,以下是本人在处理分页问题时总结出来的一个用JAVACRIPT控制的分页模式,总结了一下.这里需要用到一些图片,如果有需要的朋友可以给我发E-MAIL,我再将整个文件打包发给您.由于不是很复杂,所以这里就不做太多描述了。

/**
 * 分页处理
 *

Title: rj-page


 *

Description: rj-page v1.0


 *

Copyright: Copyright (c) 2004


 *

Company: rjsoft


 * @author thinker
 * @email  yanghuangming@rongji.com
 * @version 1.0
 */
 /**
  *@pagcCount:总页数
  *@currentPage:当前页码
  *@url:分页URL
  *@pageSize:每页显示页码数
 */
function page(pageCount,currentPage,url,pageSize){
//样式的初始化
var bgpic_no_repeat ='background-repeat:no-repeat;';
var page_num ='font-size: 9px;color: #999999;text-decoration: none;text-align: center;cursor: hand;vertical-align: top;';
var page_num_cur ='font-size: 9px;color: #ff0000;text-decoration: none;text-align: center;cursor: hand;vertical-align: top;';

//body区域
var  first,last,numClass,pageId;
var showText ="";
showText +='










     first = pageCount-pageSize+1;
  }else{
   first = currentPage;
     }
  if((first+pageSize)<=pageCount){
         last = first+pageSize;
   }else{
       last = pageCount+1;
    }
   }else{
  first = 1;
 last = pageCount+1;
  }
for(var k=first;k
showText+='




';showText+='
';showText+='
';
showText+='



';showText+='
';showText+=' 
Total:'+pageCount+'  
';showText+=' ';showText+=' ';
showText+=' ';showText+=' 
';
if(currentPage>1){
pageId = currentPage-1;
showText+='';
}
showText+=' ';
if(currentPage>1){
showText+='
';
}
showText+='
';pageId=1;showText+='
';
showText+=' ';
showText+='
';if(pageCount>pageSize) {  if(pageCount-currentPage
';
showText+='





showText+='




';//与当前页相匹配则样式显示为红否则默认if(k==currentPage){ numClass = page_num_cur;}else{ numClass = page_num;}
';showText+='
';
showText+=' '+k+'  ';
showText+='
';showText+=' ';showText+=' ';
showText+='';}//循环结束//showText+=' 
';
showText+='



';showText+='
';showText+='
';showText+=' ';showText+=' ';
showText+='';showText+='
';
if(currentPage
pageId=currentPage+1;
showText+=' ';
}
showText+=' ';
if(currentPage
showText+='
';
}
showText+='
';
document.write(showText);
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值