程序代码:
<table ><tr>
<%
set rs = server.createobject("adodb.recordset")
rs.open "select......",conn,1,1
'定议分页
dim pages,count,size
size=12
rs.pagesize = size
count = rs.pagecount
if not isempty(request("page")) then
pages = cint(request("page"))
end if
if pages<=0 then
pages=1
elseif pages<1 then
pages =1
end if
if pages>rs.pagecount then
pages=rs.pagecount
end if
rs.absolutepage = pages
call list
'显示帖子的子程序
Sub list()
If rs.eof and rs.bof then
response.write "<br> 没有内容"
exit Sub
End if
i = 0
do while not rs.eof
i = i +1
%>
<td>
<IMG SRC="admin/product/<%=rs("image")%>" width="120" height="100">
</td>
<%
p = p + 1
if p mod 3 =0 then
response.write"</tr>"
end if
if i>= size then exit do
rs.movenext
loop
end sub
%>
</table>
<table>
<tr><td style="font-size:12px; color;#FFFF00">
<%
response.write"<a href='XX.asp?page="+cstr(1)+"'>[首页]</a>"
response.write"<a href='XX.asp?page="+cstr(pages-1)+"'>[上一页]</a>"
response.write"<a href='XX.asp?page="+cstr(pages+1)+"'>[下一页]</a>"
response.write"<a href='XX.asp?page="+cstr(count)+"'>[尾页]</a>"
%>
</td></tr>
</table>