首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

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

2012-02-25 
蔡鸟提个关于显示纪录数的问题怎么将共780条记录18条/页第1/44页123456789101112131415161718192021222324

蔡鸟提个关于显示纪录数的问题
怎么将
共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        

不把纪录页数全显示出来
希望把两部分代码都给我
谢谢哈

[解决办法]
我写的一个分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
'===============================//%>
[解决办法]
<%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%>
[解决办法]
俺也来显摆一下, 不过这是 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()---------------------------------//
%>

[解决办法]
使用:


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;
%>

热点排行