/** * @name:showopage with javascript * @revision:0.13final * @rcsfile:showo_page.js * @author:yezi(ҷ��) * @date:2004/08/05 15:12:30 * @qq:311673,icq:96240724,msn:ishows@msn.com,http://www.showo.com,http://www.54nb.com */ var url,re,currentpage,firstpageurl,prevpageurl,nextpageurl,lastpageurl,currpage,pagecount,prevpage,nextpage,pagestart,pageend,i,ipage; url=""+document.location; if (url.indexof("page=")==-1) { currpage=1; } else { re=/(\s.*)(page=\d*)(\s.*|\s*)/g; currentpage=url.replace(re,"$2"); url=url.replace("&"+currentpage,""); url=url.replace(currentpage+"&",""); url=url.replace(currentpage,""); currentpage=currentpage.replace("page=","") //var re=/(?:\s{1,}page=|\d.*)/g; //var currentpage=url.replace(re,""); //url=url.replace("&page="+currentpage,""); //url=url.replace("page="+currentpage+"&",""); //url=url.replace("page="+currentpage,""); currpage=checknum(currentpage,1) } if (url.indexof("?")==-1) { url=url+"?"; } else { url=url+"&"; } url=url.replace("?&","?"); url=url.replace("&&","&"); function checknum(str,num) { str=""+str; if (str.length>=1) { mynum=parseint(str); if (isnan(mynum)) { mynum=num; } } else { mynum=num; } return (mynum); } function checkpage(ipagecount) { url=url+'&page=' url=url.replace("?&","?"); url=url.replace("&&","&"); ipage=document.iform.page.value; ipage=checknum(ipage,1) if (ipage>ipagecount) { ipage=ipagecount; } else if (ipage<1) { ipage=1; } else { ipage=ipage; } document.iform.action=url+ipage; document.iform.submit(); } function showopage(tabstart,tabend,currpagefont1,currpagefont2,pagecountfont1,pagecountfont2,prepagefont1,prepagefont2,reccountfont1,reccountfont2,firstfont,prevfont,nextfont,lastfont,jump,pagenumfont1,pagenumfont2,pagenumfont3,pagenumfont4,linkfont1,linkfont2,linkfont3,linkfont4,reccount,recperpage,pagenum) { if (reccount%recperpage==0) { pagecount=reccount/recperpage; } else { pagecount=(parseint(reccount/recperpage)+1); } if (pagecount<=1) { pagecount=1 } prevpage=parseint(currpage-1); if (prevpage<1) { prevpage=1; } nextpage=parseint(currpage+1) if (nextpage>pagecount) { nextpage=pagecount; } if (currpage<=1&&pagecount==1) { currpage=1; firstpageurl=" "+linkfont3+firstfont+linkfont4+" "; prevpageurl=" "+linkfont3+prevfont+linkfont4+" "; nextpageurl=" "+linkfont3+nextfont+linkfont4+" "; lastpageurl=" "+linkfont3+lastfont+linkfont4+" "; } else if (currpage<=1) { currpage=1; firstpageurl=" "+linkfont3+firstfont+linkfont4+" "; prevpageurl=" "+linkfont3+prevfont+linkfont4+" "; nextpageurl=" "+linkfont1+nextfont+linkfont2+" "; lastpageurl=" "+linkfont1+lastfont+linkfont2+" "; } else if (currpage>=pagecount) { currpage=pagecount; firstpageurl=" "+linkfont1+firstfont+linkfont2+" "; prevpageurl=" "+linkfont1+prevfont+linkfont2+" "; nextpageurl=" "+linkfont3+nextfont+linkfont4+" "; lastpageurl=" "+linkfont3+lastfont+linkfont4+" "; } else { currpage=currpage; firstpageurl=" "+linkfont1+firstfont+linkfont2+" "; prevpageurl=" "+linkfont1+prevfont+linkfont2+" "; nextpageurl=" "+linkfont1+nextfont+linkfont2+" "; lastpageurl=" "+linkfont1+lastfont+linkfont2+" "; } if (currpage-pagenum<=1) { pagestart=1; } else { pagestart=currpage-pagenum; } if (currpage+pagenum>=pagecount) { pageend=pagecount; } else { pageend=currpage+pagenum; } document.write ("
"); }