您的位置:程序门 -> web 开发 -> asp



蔡鸟提个关于显示纪录数的问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


蔡鸟提个关于显示纪录数的问题[已结贴,结贴人:wjjordan]
发表于:2007-01-16 11:40:49 楼主
怎么将
共780条记录   18条/页     第1/44页         1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44    
这种格式改成
共5139条记录   5条/页     第1/1028页         1     2     3     4     5     6     7     8     9     10        

不把纪录页数全显示出来
希望把两部分代码都给我
谢谢哈
发表于:2007-01-16 12:40:491楼 得分:5
我写的一个分10页的方法

<% '===============================//分页
sub   pagepart(url)
    partsize   =   10
    if   pagecount   <   2   then   exit   sub
        dim   spage,epage,p
        spage   =   page   mod   partsize
        if   page   >   partsize   then
              if   spage   =   0   then   spage   =   partsize
              spage   =   page   -   spage   +   1
        else
              spage   =   1
        end   if
        epage   =   spage   +   partsize   -   1
        if   epage   >   pagecount   then   epage   =   pagecount
        '===============================//
        response.write( " <table   width= '100% '   height=20   align= 'center '   border= '0 '   cellpadding= '0 '   cellspacing= '1 '> <tr> ")
'===============================//
response.write( " <td   width= '10% '   align= 'center '> ")
if   spage   <>   1   then
      response.write( "[ <a   href= ' "&url& "&page=1 '> <u> 第一页 </u> </a> ] ")
        end   if
        response.write( " </td> ")
'===============================//
response.write( " <td   width= '10% '   align= 'center '> ")
if   page   >   partsize   then
      response.write( "[ <a   href= ' "&url& "&page= "&spage-1& " '> <u> 前 "&partsize& "页 </u> </a> ] ")
        end   if
        response.write( " </td> ")
        '===============================//
        response.write( " <td   align= 'center '> ")
        for   p   =   spage   to   epage
                if   p   =   page   then
                      response.write   "[ <font   color= '#cc0000 '> <b> "&p& " </b> </font> ]   "
                else
                      response.write   " <a   href= ' "&url& "&page= "&p& " '> [ <u> "&p& " </u> ] </a>   "
                end   if
        next
response.write( " </td> ")
'===============================//
response.write( " <td   width= '10% '   align= 'center '> ")
if   epage   <   pagecount   then
      response.write( "[ <a   href= ' "&url& "&page= "&epage+1& " '> <u> 后 "&partsize& "页 </u> </a> ] ")
        end   if
        response.write( " </td> ")
'===============================//
        response.write( " <td   width= '10% '   align= 'center '> ")
if   epage   <>   pagecount   then
      response.write( "[ <a   href= ' "&url& "&page= "&pagecount& " '> <u> 最后页 </u> </a> ] ")
        end   if
        response.write( " </td> ")
'===============================//
        response.write( " </tr> </table> ")
end   sub
'===============================//%>
发表于:2007-01-16 12:42:362楼 得分:5
<%if   page= " "   then
k=1
else
k=page '当前页,n为总页数
end   if
if   totalput= " "   then
totalput=0 '数据总数
end   if
response.write   "[共搜索到 <font   color=red> "&totalput& " </font> 条数据/分 <font   color=red> "&n& " </font> 页/当前第 <font   color=red> "&k& " </font> 页]&nbsp; "
if   (k-1> 0)   then
response.write   " <a   href=?page=1> 首页 </a>   "
response.write   " <a   href=?page= "+cstr(k-1)+ "> 上一页 </a>   "
else
response.write   "首页   "
response.write   "上一页   "
end   if
if   (n-k)> 0   then
response.write   " <a   href=?page= "+cstr(k+1)+ "> 下一页 </a>   "
response.write   " <a   href=?page= "+cstr(n)+ "> 末页 </a>   "
else
response.write   "下一页   "
response.write   "末页   "
end   if%> </td>
<td   height= "25 "   align=center   width= "52% ">
<%i=k-1
j=5
for   l=(k-i)   to   j
j=j-1
if   k-j> 0   then

if   k-j=currentpage   then
response.write   " <font   color=red> "&k& " </font>   "
else
response.write   " <a   href=?page= "+cstr(k-j)+ "> "&k-j& " </a>   "
end   if

end   if
next


i=0
for   l=k   to   k+6
i=i+1
if   k+i <=n   then
response.write   " <a   href=?page= "+cstr(k+i)+ "> "&k+i& " </a>   "
end   if
next%>
发表于: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()---------------------------------//
%>
发表于:2007-01-16 12:46:414楼 得分:5
使用:


shawl.qiu   framework   jscript   server-side

---/------------------------------------------------------------------------------

pagination()

<%
  var   conn=   "provider=microsoft.jet.oledb.4.0;persist   security   info=false;data   source= "+
server.mappath( "sqeditor/data/shawlqiu.mdb ");

var   rs=new   activexobject( 'adodb.recordset ');
  rs.open( 'select   *   from   shawlqiu_ ',   conn,   1)

var   page=request.querystring( 'page ')> 0?   request.querystring( 'page '):   1;

  var   paged=new   pagination();
   
    paged.rs=rs;
    paged.pagesize=20;
    paged.absltpage=page;
    paged.listnum=10;
    paged.queryid= 'page ';
   
    response.write( ' <div   class= "pagenav "> ');
    paged.getlist();
    paged.getinfo();
    response.write( ' </div> ');
   
    paged=null;
   
    response.write( ' <p/> ');
for(var   i=0;   i <20;   i++){
if(rs.eof ¦ ¦rs.bof)   break;
response.write((rs( 'title ')+ '   ').link( '?id=edit&atc= '+rs( 'articleid ')));
response.write( ' <br/> ');
rs.movenext
}

    rs.close();
  rs=null;
%>
发表于:2007-01-16 13:16:185楼 得分:0
不能在开始那种里添几行代码解决吗
发表于:2007-01-22 14:58:546楼 得分:0
我自己解决了   呵呵
不过还是感谢你们了
分数平均分吧


快速检索

热门点击