分頁|函數
const MaxPerPage=18
dim page
if not request("page")="" then
Page=cint(request("page"))
else
Page=1
end if
dim i
i=0
rs.move (Page-1)*MaxPerPage
分頁
do while
' 中間是迴圈段
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
===========================
totalnumber = 記錄總數
maxperpage = 每頁記錄數
filename = 分頁的檔案名稱
<%
function showpage(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'><font color='#000080'>>>分頁</font> "
if page<2 then
response.write "<font color='#000080'>首頁 上一頁</font> "
else
response.write "<a href="&filename&"?page=1&>首頁</a> "
response.write "<a href="&filename&"?page="&page-1&">上一頁</a> "
end if
if n-page<1 then
response.write "<font color='#000080'>下一頁 尾頁</font>"
else
response.write "<a href="&filename&"?page="&(page+1)
response.write ">下一頁</a> <a href="&filename&"?page="&n&">尾頁</a>"
end if
response.write "<font color='#000080'> 頁次:</font><strong><font color=red>"&page&"</font><font color='#000080'>/"&n&"</strong>頁</font> "
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>條記錄 <b>"&maxperpage&"</b>條記錄/頁</font> "
response.write " <font color='#000080'>轉到:</font><input type='text' name='page' size=4 value="&page&">"
response.write "<input type=submit name=Submit value=go> </span></p>"
end function
%>