ASP更改产品每页显示数量
现在每页显示的是10个产品.每行显示3个,三行多一个.(还有两个空位就转页了,很不好看)现想显示12个每页.每行显示3个或4个..谢谢!高手帮改下.!代码如下:subSh...
现在每页显示的是10个产品.每行显示3个,三行多一个.(还有两个空位就转页了,很不好看)现想显示12个每页.每行显示3个或4个..谢谢!高手帮改下.!代码如下:
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 align=center BORDER=0 CELLSPACING=1 CELLPADDING=0>"
strTemp= strTemp & "<tr>"
do while not rsProduct.eof
strTemp= strTemp & "<td width=270>"
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 width=135> <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 & "</tr>"
strTemp= strTemp & "</table>"
strTemp= strTemp & "</td>"
strTemp= strTemp & "</tr><tr>"
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 展开
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 align=center BORDER=0 CELLSPACING=1 CELLPADDING=0>"
strTemp= strTemp & "<tr>"
do while not rsProduct.eof
strTemp= strTemp & "<td width=270>"
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 width=135> <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 & "</tr>"
strTemp= strTemp & "</table>"
strTemp= strTemp & "</td>"
strTemp= strTemp & "</tr><tr>"
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 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询