| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 723 人关注过本帖
标题:分页问题
只看楼主 加入收藏
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
 问题点数:0 回复次数:4 
分页问题
<%sql="select * from article where typeid=("&typeid&") order by dateandtime desc"
set rs=conn.execute(sql)
if rs.bof and rs.eof then
response.write "暂时没有任何内容"
else
  url="more.asp?typeid="&typeid
  rs.pagesize=5
  PageNo=request("PageNo")
  if PageNo="" or PageNo=0 then PageNo=1
  rs.AbsolutePage=PageNo
  TSum=rs.pagecount
  maxperpage=rs.pagesize
    PageNo=PageNo+1
    PageNo=PageNo-1
  if CINT(pageno)>1 then
     if CINT(pageno)>CINT(TSum) then
    response.Write("对不起没有您想要的页数")
          Response.End
     end if
  end if      
     if PageNo<0 then
     response.Write("没有这一页!")
  Response.End
  End if   
i=0
do while not rs.eof and i<rs.pagesize
%><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="344" class="P"><font color=\"#0066cc\">○</font><a href='../<%=rs("path")%>/<%=rs("N_Fname")%>'><%=rs("title")%></a></td>      
  </tr>
    </table>
 <%i=i+1
rs.movenext
loop
%>
</td>
  </tr>
  <tr>
    <td height="21"> </td>
    <td align="right" valign="top">
<% call showpage(url,rs.RECORDCOUNT,maxperpage,false,true,"条主题") %>
<%end if%>
<%
rs.close
set rs =nothing
conn.close
set conn=nothing
%>
不能显示分页啊。但可以控制每页的条数。
搜索更多相关主题的帖子: PageNo typeid CINT response 
2005-08-14 14:53
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 

这是SHOWPAGE: <% function JoinChar(strUrl) if strUrl="" then JoinChar="" exit function end if if InStr(strUrl,"?")<len(strUrl) then if InStr(strUrl,"?")>1 then if InStr(strUrl,"&")<len(strUrl) then JoinChar=strUrl & "&" else JoinChar=strUrl end if else JoinChar=strUrl & "?" end if else JoinChar=strUrl end if end function

sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit) if totalnumber>0 then dim n, i,strTemp,strUrl if totalnumber mod maxperpage=0 then n= totalnumber \ maxperpage else n= totalnumber \ maxperpage+1 end if strTemp=strTemp & "共 <font color=blue><b>" & totalnumber & "</b></font> " & strUnit & "&nbsp;&nbsp;&nbsp;" strUrl=JoinChar(sfilename) if PageNo<2 then strTemp=strTemp & "首页 上一页&nbsp;" else strTemp=strTemp & "<a href='" & strUrl & "PageNo=1'>首页</a>&nbsp;" strTemp=strTemp & "<a href='" & strUrl & "PageNo=" & (PageNo-1) & "'>上一页</a>&nbsp;" end if

if n-PageNo<1 then strTemp=strTemp & "下一页 尾页" else strTemp=strTemp & "<a href='" & strUrl & "PageNo=" & (PageNo+1) & "'>下一页</a>&nbsp;" strTemp=strTemp & "<a href='" & strUrl & "PageNo=" & n & "'>尾页</a>" end if strTemp=strTemp & "&nbsp;页次:<strong><font color=red>" & PageNo & "</font>/" & n & "</strong>页 " strTemp=strTemp & "&nbsp;<b>" & maxperpage & "</b>" & strUnit & "/页" if ShowAllPages=True then strTemp=strTemp & "&nbsp;转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "PageNo=" & "'+this.options[this.selectedIndex].value;"">" for i = 1 to n strTemp=strTemp & "<option value='" & i & "'" if cint(PageNo)=cint(i) then strTemp=strTemp & " selected " strTemp=strTemp & ">第" & i & "页</option>" next strTemp=strTemp & "</select>" end if response.write strTemp end if end sub %>


中国人的财富网:http://www..cn/
2005-08-14 14:56
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 
SHOWPAGE没问题,因为那是别人早写好的了,我直接拿过来用的。

中国人的财富网:http://www..cn/
2005-08-14 14:57
rainic
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2367
专家分:0
注 册:2005-8-9
收藏
得分:0 
别人写的放在别人那是没问题,放在你那就很不一定了。你完全不作修改也不行吧。
建议你把代码看懂后再自己写

2005-08-14 21:27
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
收藏
得分:0 
就改个URL就可以了,我以前用完全没问题,现在就不行了。

中国人的财富网:http://www..cn/
2005-08-14 22:54
快速回复:分页问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025653 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved