文件名称:网页开发中的jsp分页代码
文件大小:33KB
文件格式:DOC
更新时间:2012-08-20 03:16:37
分页代码
function setpage() { if(totalpage<=10){ //总页数小于十页 for (count=1;count<=totalpage;count++) { if(count!=cpage) { outstr = outstr + ""+count+""; }else{ outstr = outstr + ""+count+""; } } } if(totalpage>10){ //总页数大于十页 if(parseInt((cpage-1)/10) == 0) { for (count=1;count<=10;count++) { if(count!=cpage) { outstr = outstr + ""+count+""; }else{ outstr = outstr + ""+count+""; } } outstr = outstr + " next "; } else if(parseInt((cpage-1)/10) == parseInt(totalpage/10)) { outstr = outstr + "previous"; for (count=parseInt(totalpage/10)*10+1;count<=totalpage;count++) { if(count!=cpage) { outstr = outstr + ""+count+""; }else{ outstr = outstr + ""+count+""; } } } else { outstr = outstr + "previous"; for (count=parseInt((cpage-1)/10)*10+1;count<=parseInt((cpage-1)/10)*10+10;count++) { if(count!=cpage) { outstr = outstr + ""+count+""; }else{ outstr = outstr + ""+count+""; } } outstr = outstr + " next "; } } document.getElementById("setpage").innerHTML = "
网友评论
- 还不错,挺适合现在做的东西