<%
num_row=3 '每行放置的产品数
rows=3 '放置的产品行数
maxpp=num_row*rows '分页需要MaxPP
set rs=server.createobject("adodb.recordset")
sql="select * from shop_books where nclassid="&nid&" order by adddate desc"
rs.open sql,conn,1,1
if rs.eof then
response.Write"No record!"
else
page=cint(request("page"))
strFilename="auction2.asp?lx=big&anid="
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
totalPut=rs.recordcount
if (currentPage-1)*MaxPP>totalPut then
if(totalPut mod MaxPP)=0 then
currentPage=totalPut \ MaxPP
else
currentPage=totalPut \ MaxPP + 1
end if
end if
if currentPage=1 then(www.111com.net)
showContent
showpage totalPut,MaxPP,strFilename
else
if (currentPage-1)*MaxPP
rs.move (currentPage-1)*MaxPP
showContent
showpage totalPut,MaxPP,strFilename
else
currentPage=1
showContent
showpage totalPut,MaxPP,strFilename
end if
end if
end if
%>
<%sub showContent%>
<%
j=1 '初始化j,它的值是页面显示的产品数量
do while not (rs.eof or err) '当存在记录时
if (j mod num_row)=1 then response.write "" end if 'j从1开始递增,开始显示1行
%>
|
<%
if (j mod num_row)=0 then response.write "
" end if '当j的值是num_row的倍数的时候结束一行
j=j+1
if j>maxpp then exit do
rs.moveNext
loop '循环啦
%>
<%
dim k
k=(j-1) mod num_row
if not (k=0) then
response.write " | "
response.write ""
end if
%>
<%end sub%>
<%
function showpage(totalPut,MaxPP,filename)
dim n
if totalPut mod MaxPP=0 then
n=totalPut \ MaxPP
else
n=totalPut \ MaxPP+1
end if
response.write"