asp网站的一个sub改写
我要实现的是调用出来的东西排布成每页九个,并且要和翻页是对应的,谢谢大虾指点。sub ShowProduct(TitleLen)
if TitleLen<0 or TitleLen>200 then
TitleLen=50
end if
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
sqlProduct="select top " & MaxPerPage
else
sqlProduct="select "
end if
sqlProduct=sqlProduct & " ID,Product_Id,BigClassName,SmallClassName,IncludePic,Title,Price,Spec,Unit,Memo,DefaultPicUrl,UpdateTime,Hits from Product where Passed=True "
if BigClassName<>"" then
sqlProduct=sqlProduct & " and BigClassName='" & BigClassName & "' "
if SmallClassName<>"" then
sqlProduct=sqlProduct & " and SmallClassName='" & SmallClassName & "' "
end if
end if
sqlProduct=sqlProduct & " order by UpdateTime desc"
Set rsProduct= Server.CreateObject("ADODB.Recordset")
rsProduct.open sqlProduct,conn,1,1
if rsProduct.bof and rsProduct.eof then
response.Write("<br><li>没有任何产品</li>")
else
if currentPage=1 then
call ProductContent(TitleLen)
else
if (currentPage-1)*MaxPerPage<totalPut then
rsProduct.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsProduct.bookmark
call ProductContent(TitleLen)
else
currentPage=1
call ProductContent(TitleLen)
end if
end if
end if
rsProduct.close
set rsProduct=nothing
end sub
sub ProductContent(intTitleLen)
dim i,strTemp,ViewList
i=1
ViewList=3
strTemp=""
strtemp= strtemp & "<p>"
strTemp= strTemp & "<TABLE width='98%' align=center BORDER=0 CELLSPACING=1 CELLPADDING=0>"
strTemp= strTemp & "<tr>"
do while not rsProduct.eof
strTemp= strTemp & "<td width=170>"
strTemp= strTemp & "<table align=center width=170 border=0 cellspacing=2 cellpadding=0>"
strTemp= strTemp & "<tr>"
strTemp= strTemp & "<td colspan=2>"
strTemp= strTemp &"<TABLE border=0 cellPadding=0 cellSpacing=5>"
strTemp= strTemp &"<TR>"
strTemp= strTemp &"<TD align=middle > <TABLE align=center border=0 cellPadding=0 cellSpacing=0>"
strTemp= strTemp &"<TR>"
strTemp= strTemp &"<TD height=10><IMG height=10 src='Img/bg_0ltop.gif' width=10></TD>"
strTemp= strTemp &"<TD background='Img/bg_01.gif' height=10></TD>"
strTemp= strTemp &"<TD height=10><IMG height=10 src='Img/bg_0rtop.gif' width=10></TD>"
strTemp= strTemp &"</TR>"
strTemp= strTemp &"<TR> "
strTemp= strTemp &"<TD background='Img/bg_03.gif' width=10> </TD>"
strTemp= strTemp & "<td width=130 height=100>"&"<div align=center>"
strTemp= strTemp & "<a href=ProductShow.asp?ID=" & rsProduct("id") & ">" & "<img src=" & rsProduct("DefaultPicUrl") & " width='130' height='100' border='0' >" & "</a><br></div>"
strTemp= strTemp & "</td>"
strTemp= strTemp &"<TD background='Img/bg_04.gif' width=10> </TD>"
strTemp= strTemp &"</TR>"
strTemp= strTemp &"<TR>"
strTemp= strTemp &"<TD height=10><IMG height=10 src='Img/bg_0lbottom.gif' width=10></TD>"
strTemp= strTemp &"<TD background=Img/bg_02.gif height=10></TD>"
strTemp= strTemp &"<TD height=10><IMG height=10 src='Img/bg_0rbottom.gif' width=10></TD>"
strTemp= strTemp &"</TR>"
strTemp= strTemp &"</TABLE></TD>"
strTemp= strTemp &"</TR>"
strTemp= strTemp &"</TABLE>"
strTemp= strTemp & "</a></div></td>"
strTemp= strTemp & "</tr><tr>"
strTemp= strTemp & "<td align=right width=70>"
strTemp= strTemp & "名称:</td>"
strTemp= strTemp & "<td align=left width=100>"
strTemp= strTemp & "<a href=ProductShow.asp?ID=" & rsProduct("id") & ">" & rsProduct("Title") & ""
strTemp= strTemp & "</a></td>"
'strTemp= strTemp & "</tr><tr>"
' strTemp= strTemp & "<td align=right>"
' strTemp= strTemp & "编号:</td>"
' strTemp= strTemp & "<td>"
' strTemp= strTemp & rsProduct("Product_Id") & ""
' strTemp= strTemp & "</a></td>"
strTemp= strTemp & "</tr><tr>"
strTemp= strTemp & "<td colspan=2>"
strTemp= strTemp & "<table width=100% border=0 cellpadding=0 cellspacing=0>"
strTemp= strTemp & "<tr>"
strTemp= strTemp & "<td>"
strTemp= strTemp & "<div align=center></div></td>"
strTemp= strTemp & "<tr>"
strTemp= strTemp & "<td width=50% height=12>"
strTemp= strTemp & "<div align=center></div></td>"
strTemp= strTemp & "<td width=50% height=12>"
strTemp= strTemp & "</td>"
strTemp= strTemp & "</tr>"
strTemp= strTemp & "</tr>"
strTemp= strTemp & "</table>"
strTemp= strTemp & "</td>"
strTemp= strTemp & "</tr>"
strTemp= strTemp & "</table>"
if i mod ViewList =0 then
strTemp= strTemp & "</td></tr>"
end if
rsProduct.MoveNext
i=i+1
if i>MaxPerPage then exit do
loop
strtemp= strtemp & "</tr></table>"
response.write strTemp
end sub --------------------编程问答-------------------- 我也是换到这种问题,我只想要一页显示9个产品就好。三行三列
补充:VB , 网络编程