动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Asp → 阅读文章

 怎么用ASP实现分页(二)

作者来源: 
阅读 4934 人次 , 2000-4-22 

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>

<%
dim currentpage  '定义当前页
dim filename     '文件名
Const MaxPerPage=20   '每页显示的记录个数
dim totalnumber  '记录总数
filename="showpages.asp"
totalnumber=200     '设置记录总数为200

if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
end if
showpages totalnumber,MaxPerPage,filename
%>
</BODY>
</HTML>
<%'定义分页的函数,以totalnumber,maxperpage,filename作为函数的入口。
function showpages()
    dim n
    if (totalnumber mod MaxPerPage)=0 then
       n= totalPut \ MaxPerPage
    else
       n= totalPut \ MaxPerPage + 1
    end if
    if n=1 then
        exit sub
    end if
    dim k
    response.write "<p align='left'>&gt;&gt; 分页 "
      for k=1 to n
        if k=currentPage then
   response.write "[<b>"+Cstr(k)+"</b>] "
else
  response.write "[<b>"+"<a href="&filename&"?page="+cstr(k)+">"+Cstr(k)+"</a></b>] "
        end if
      next
    response.write "</p>"
   end function
%>   
 本文Tags分页  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:有关ASP的一些常见问题(一)
· 下一篇:怎么用ASP实现分页(一)
· SUNWEN教程之----C#进阶(十)
· 使用循环语句
· 安全维护 IIS asp 站点的高级技巧
· asp性能测试报告(转)(六)
· 使用FSO按文件大小浏览文件目录并进行删除操作


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077