日期:2014-05-16 浏览次数:20338 次
<html> <head> <title></title> </head> <style type="text/css"> a:link,a:visited,a:hover,.current,#info{ border:1px solid #DDD; background:#F2F2F2; display:inline-block; margin:1px; text-decoration:none; font-size:12px; height:15px; text-align:center; line-height:15px; color:#AAA; padding:1px 2px; } a:hover{ border:1px solid #E5E5E5; background:#F9F9F9; } .current{ border:1px solid #83E7E4; background:#DFF9F8; margin:1px; color:#27CBC7; } #info{ width:auto; } </style> <body> 这是第1页 <div id="setpage"></div> <script type="text/javascript"> <!-- var totalpage,pagesize,cpage,count,curcount,outstr; var prefixion,suffixation; //初始化 cpage = Page(); //初始页 totalpage = 29; //总页数,你这个如何确定?? pagesize = 8; prefixion="shooting"; //文件名前缀 suffixation=".htm"; //文件名后缀 outstr = ""; function Page(){ //取得当前页面 var page,$p; $p=location.href; $p=$p.substr($p.lastIndexOf("/")+1,$p.length-$p.lastIndexOf("/")); page=parseInt($p.replace(/\D/g,''))==0?1:parseInt($p.replace(/\D/g,'')); return page; } document.title="第"+Page()+"页"; function gotopage(target) { cpage = target; //把页面计数定位到第几页 location.href=prefixion+target+suffixation; } function setpage() { if(totalpage<=pagesize){ //总页数小于pagesize 页 for (count=1;count<=totalpage;count++) { if(count!=cpage) { outstr = outstr + "<a href='javascript:gotopage("+count+");'>"+count+"</a>"; }else{ outstr = outstr + "<span class='current' >"+count+"</span>"; } } } if(totalpage>pagesize){ //总页数大于pagesize 页 if(parseInt((cpage-1)/pagesize) == 0) { for (count=1;count<=pagesize;count++) { if(count!=cpage) { outstr = outstr + "<a href='javascript:gotopage("+count+");'>"+count+"</a>"; }else{ outstr = outstr + "<span class='current'>"+count+"</span>"; } } outstr = outstr + "<a href='javascript:gotopage("+count+");'> 后"+pagesize+"页 </a>"; } else if(parseInt((cpage-1)/pagesize) == parseInt(totalpage/pagesize)) { outstr = outstr + "<a href='javascript:gotopage("+(parseInt((cpage-1)/pagesize)*pagesize)+")'>前"+pagesize+"页</a>"; for (count=parseInt(totalpage/pagesize)*pagesize+1;count<=totalpage;count++) { if(count!=cpage) { outstr