日期:2014-05-16 浏览次数:20453 次
<script language=javascript>
function WritePager(pageIndex,pageCount,pageName,ext){ if(pageCount>1){ var pagelen=7; var startPage=pageIndex-3; if(startPage<0) startPage=0; var endpage=pagelen+startPage; if(endpage>pageCount)endpage=pageCount; startPage=endpage-7; if(startPage<0) startPage=0; if(pageIndex>1) { document.write("<a href=\""+pageName+"."+ext+"\">首页</a> "); document.write(" <a href=\""+pageName+"_"+(pageIndex-1)+"."+ext+"\">上一页</a> "); } else if(pageIndex==1){ document.write("<a href=\""+pageName+"."+ext+"\">首页</a> "); document.write(" <a href=\""+pageName+"."+ext+"\">上一页</a> "); } else{ document.write(" 首页</a> "); document.write(" 上一页 "); } for(var i=startPage;i<endpage;i++){ if(i==pageIndex){ document.write(" <font color=red>"+(i+1)+"<\/font> "); }else if(i==0){ document.write(" <a href=\""+pageName+"."+ext+"\">"+(i+1)+"</a> "); }else{ document.write(" <a href=\""+pageName+"_"+i+"."+ext+"\">"+(i+1)+"</a> "); } } if(pageIndex<pageCount-1){ document.write(" <a href=\""+pageName+"_"+(pageIndex+1)+"."+ext+"\">下一页</a> "); document.write("<a class='pagebar' href=\"" + pageName + "_" + (pageCount-1) + "." + ext + "\">尾页</a>"); } else{ document.write(" 下一页 "); document.write(" 尾页</a>"); } } } WritePager(0,100,"index","html"); </script>
?