| 发表于:2007-01-16 12:46:083楼 得分:5 |
俺也来显摆一下, 不过这是 jscript 版的 <% /*-----------------------------------------------------------------------------------*\ * shawl.qiu asp/jscript 记录集分页类 v1.0 \*-----------------------------------------------------------------------------------*/ //---------------------------------begin class pagination()-------------------------------// function pagination(){ // shawl.qiu code //------------------------------------begin public variable //---------------begin about this.ausubject= 'shawl.qiu asp/jscript 记录集分页类 '; this.auversion= '1.0 '; this.au= 'shawl.qiu '; this.auemail= 'shawl.qiu@gmail.com '; this.aublog= 'http://blog.csdn.net/btbtd '; this.aucreatedate= '2007-1-10 '; //---------------end about this.rs= ' '; // recordset object this.pagesize=20; // recordset.pagesize; this.absltpage=1; // recordset.absolutepage; this.listnum=10; // show the link list; this.queryid= 'page '; // url querystring( 'page '); this.word=function(){}; this.word.first= '首页 '; this.word.last= '尾页 '; this.word.previousten= '上十 '; this.word.previous= '上一 '; this.word.next= '下一 '; this.word.nextten= '下十 '; //------------------------------------end public variable //------------------------------------begin public method this.getlist=function(){ tl_EXEC=true; tl_rscount=tl.rs.recordcount; if(!tl_rscount)return false; if(tl_rscount== ' ')return false; if(tl_rscount===0)return false; var pgall=math.ceil(tl_rscount/tl.pagesize); if(tl.pagesize> tl_rscount)return false; var surl= '? '+request.servervariables( "query_string ")+ '& '+tl.queryid+ '= '; var re=new regexp(tl.queryid+ '\=.* ', 'i ') surl=surl.replace(re,tl.queryid+ '= ').replace( '?& ', '? ').replace( '&& ', '& '); tl.rs.pagesize=tl.pagesize; // 设置每页大小 if(tl.absltpage <1) tl.absltpage=1; // 当前所在页 if(tl.absltpage> pgall) tl.absltpage=pgall; tl.rs.absolutepage=tl.absltpage; response.write( ' <div class= "sqpagedl "> '); tl.absltpage> 1?response.write( ' <a href= " '+surl+ '1 "> '+tl.word.first+ ' </a> ') :response.write( ' <span class= "sqpagednonlink "> '+tl.word.first+ ' </span> '); if(pgall> tl.listnum) tl.absltpage> 10?response.write( ' <a href= " '+surl+(tl.absltpage-0-10-(tl.absltpage%10)+1)+ ' "> '+ tl.word.previousten+ ' </a> ') :response.write( ' <span class= "sqpagednonlink "> '+ tl.word.previousten+ ' </span> '); tl.absltpage> 1?response.write( ' <a href= " '+surl+(tl.absltpage-1)+ ' "> '+ tl.word.previous+ ' </a> ') :response.write( ' <span class= "sqpagednonlink "> '+tl.word.previous+ ' </span> '); for(var i=0, temp=tl.absltpage-(tl.absltpage%tl.listnum)+1, temp_= ' '; i <tl.listnum; temp++, i++){ if(temp> pgall) break; temp==tl.absltpage?response.write( ' <span class= "sqpagedcurlink "> '+temp+ ' </span> ') :response.write( ' <a href= " '+surl+temp+ ' "> '+temp+ ' </a> '); } tl.absltpage <pgall?response.write( ' <a href= " '+surl+(tl.absltpage-0+1)+ ' "> '+ tl.word.next+ ' </a> ') :response.write( ' <span class= "sqpagednonlink "> '+tl.word.next+ ' </span> '); if(pgall> tl.listnum) tl.absltpage <pgall-9?response.write( ' <a href= " '+surl+(tl.absltpage-0+ 10-(tl.absltpage%10)+1)+ ' "> '+ tl.word.nextten+ ' </a> ') :response.write( ' <span class= "sqpagednonlink "> '+tl.word.nextten+ ' </span> '); tl.absltpage!=pgall?response.write( ' <a href= " '+surl+pgall+ ' "> '+tl.word.last+ ' </a> ') :response.write( ' <span class= "sqpagednonlink "> '+tl.word.last+ ' </span> '); response.write( ' 转到: <input type= "text " size= "6 " '+ 'class= "sqjump " onkeypress= "fg2url(this.value,event) " /> \n ' ); response.write( ' <script type= "text/javascript "> \n ') response.write( '// <![cdata[\n ') response.write( ' function fg2url(surl, oevt){\n ') response.write( ' if(!oevt)var oevt=window.event;\n ') response.write( ' var kc=oevt.which ¦ ¦oevt.keycode;\n ') response.write( ' if(kc==13){\n ') response.write( ' window.location.href= " '+surl+ ' "+surl}\n ') response.write( ' } ') response.write( '\n//]]> ') response.write( ' </script> '); response.write( ' <style type= "text/css "> \n '); response.write( '/* <![cdata[ */\n '); response.write( ' .sqjump{\n '); response.write( ' border:0px;\n '); response.write( ' border-bottom:1px dashed black;\n '); response.write( ' }\n '); response.write( '/* ]]> */\n '); response.write( ' </style> '); response.write( ' </div> '); } // end this.getlist this.getinfo=function(){ var rscount=0; if(!tl_EXEC){ rscount=tl.rs.recordcount; } else { rscount=tl_rscount; } response.write( ' <div class= "sqpagedinfo "> '); response.write(tl.rs.pagesize+ '篇/页 '); response.write(tl.rs.absolutepage+ '/ '+tl.rs.pagecount+ '页 '); response.write( '共 '+tl_rscount+ '篇 '); response.write( ' </div> '); } // this.getinfo //------------------------------------end public method //------------------------------------begin private variable var tl=this; var tl_rscount=0; var tl_EXEC=false; //------------------------------------end private variable //------------------------------------begin private method //------------------------------------end private method } // shawl.qiu code //---------------------------------end class pagination()---------------------------------// %> | | |
|