直播中
<%
dim currentpage '定義當(dāng)前頁(yè)
dim filename '文件名
Const MaxPerPage=20 '每頁(yè)顯示的記錄個(gè)數(shù)
dim totalnumber '記錄總數(shù)
filename="showpages.asp"
totalnumber=200 '設(shè)置記錄總數(shù)為200
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
showpages totalnumber,MaxPerPage,filename
%>
</BODY>
</HTML>
<%'定義分頁(yè)的函數(shù),以totalnumber,maxperpage,filename作為函數(shù)的入口。
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'>>> 分頁(yè) "
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
%>