<%
strsql="*****************************************"
'这里根据条件自己写
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 1
if not rs.eof then
page=12
rs.pagesize=page
maxpage=rs.pagecount
if pageno < 1 then
pageno =1
end if
if pageno+1 >maxpage+1
then
pageno=maxpage
end if
rs.absolutePage=pageno
else
maxpage=1
end if
total = rs.RecordCount
%>
'这里执行for
或do while 或while循环都可以,略了.
<%
'===========================
'产生1\2\3\4\5\6\7\8\9\10 等等
sub pages()
pagelast=pageno+9
if pagelast>=maxpage then
pagelast=maxpage
end if
for i=pageno to pagelast
dim str,link0,link1
link0="<a href="&"product.asp?pageno="&i&">"
link1="</a>"
str="&nbsp;"&link0&i&link1
response.Write str
next
end sub
'通过下拉列表直接跳转
sub selectp()
response.Write "跳转到"&" <form action='product.asp' method='post' ><select name='pageno' onChange='javascript:submit()'>"
for i=1 to maxpage
response.Write "<option value="&i&">"&"第"&i&"页"&"</option>"
next
response.write "</form>"
end sub
%>