注册 登录
编程论坛 ASP技术论坛

asp 生成静态页面后分页

var_time 发布于 2009-09-14 20:52, 878 次点击
新来的啊, 在生成静态页后,不知道怎么写分页啊, 求高手能提示下详细思路地怎样的啊。。
   有例子更好啊, 不吝赐教。
3 回复
#2
无诲今生2009-09-15 01:00
下边是一个分页程序的部分,自己修改一下就可以用了
<%
......
set rs=createobject("ADODB.recordset")
......
rs.PageSize=20  '这个设置页数的大小
totalpage=rs.PageCount  '这个获取总共的页数
currentpage=request("currentpage")  '获取当前所在的页
%>
 
<%
'下边用来显示记录
rs.Move (currentpage-1)*20
do while(not rs.eof)
......
rs.MoveNext
loop
&>
 
<%
if cint(currentpage)<>1 then
%>
<a href=context1.asp?currentpage=1><font color=red>第一页</font></a>&nbsp;&nbsp;
<%
end if
if cint(currentpage)<>cint(totalpage) then
%>
<a href=context1.asp?currentpage=<%=totalpage%>><font color=red>最后页</font></a>&nbsp;&nbsp;
<%
end if
if totalrecord<=maxrecord then
%>
上一页&nbsp;&nbsp;下一页
<%
else
     if cint(currentpage)=cint(totalpage) then
        currentpage=cint(currentpage)-1
%>
       <a href=context1.asp?currentpage=<%=currentpage%>><font color=red>上一页</font color=red></a>&nbsp;&nbsp;下一页
<%
     else
          if currentpage=1 then
             currentpage=currentpage+1
%>
            上一页&nbsp;&nbsp;<a href=context1.asp?currentpage=<%=currentpage%>><font color=red>下一页</font></a>
<%
          else
             currentpage1=currentpage-1
             currentpage2=currentpage+1
%>
          <a href=context1.asp?currentpage=<%=currentpage1%>><font color=red>上一页</font></a>&nbsp;&nbsp;<a href=context1.asp?currentpage=<%=currentpage2%>><font color=red>下一页</font></a>
<%
          end if
     end if
end if
 
%>
#3
skybirdzw2009-09-15 08:04
可以在生成静态页的循环里寻找分页标记,标记自己加的,然后生成分页
#4
aspic2009-09-15 08:39
2#貌似随便复制一个过来敷衍了事一样
看清楚了再回答撒

静态页的列表分页其实跟一般的动态页分页差不多 比如生成的是new-show-01.html之类的 分页就比如new-list-01.html第一页(列表)new-list-02.html 就是输出链接的方式做了一下修改
1