直播中
<%
dim currentpage '定義當(dāng)前頁
dim filename '文件名
Const MaxPerPage=20 '每頁顯示的記錄個數(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>
<%'定義分頁的函數(shù),以totalnumber,maxperpage,filename作為函數(shù)的入口。
function showpages(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&">"
response.write "<p align='center'>記錄分頁 "
if CurrentPage<2 then
response.write "<font color='999966'>首頁 上一頁</font> "
else
response.write "<a href="&filename&"?page=1>首頁</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一頁</a> "
end if
if n-currentpage<1 then
response.write "<font color='999966'>下一頁 尾頁</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)
response.write ">下一頁</a> <a href="&filename&"?page="&n&">尾頁</a>"
end if
response.write " 頁次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>頁 "
response.write " 轉(zhuǎn)到:<input type='text' name='page' size=4 maxlength=10 class=smallInput
value="¤tpage&">"
response.write "<input class=buttonface type='submit' value=' Goto ' name='cndok'></span></p></form>"
end function
%>