欢迎光临
我们一直在努力

怎么用ASP实现分页(二)

建站超值云服务器,限时71元/月

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

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 怎么用ASP实现分页(二)
分享到: 更多 (0)