| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 706 人关注过本帖
标题:产品展示限制每行数量谁能指点下
只看楼主 加入收藏
gudluck
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-11-25
收藏
 问题点数:0 回复次数:1 
产品展示限制每行数量谁能指点下

最近我遇到一段代码,是关于产品展示的,但是每行只显示1个产品,每页显示5个产品,我想改成每行显示2个,每页显示4个,怎么改也不对,请高手帮忙,改下代码,谢谢/
sub ShowArticle(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
sqlArticle="select top " & MaxPerPage
else
sqlArticle="select "
end if

sqlArticle=sqlArticle & " ArticleID,Product_Id,BigClassName,SmallClassName,IncludePic,Title,DefaultPicUrl,UpdateTime,Hits from Product where Passed=True "

if BigClassName<>"" then
sqlArticle=sqlArticle & " and BigClassName='" & BigClassName & "' "
if SmallClassName<>"" then
sqlArticle=sqlArticle & " and SmallClassName='" & SmallClassName & "' "
end if
else
if SpecialName<>"" then
sqlArticle=sqlArticle & " and SpecialName='" & SpecialName & "' "
end if
end if

Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sqlArticle,conn,1,1
if rsArticle.bof and rsArticle.eof then
response.Write("<br><li>没有任何产品</li>")
else
if currentPage=1 then
call ArticleContent(TitleLen)
else
if (currentPage-1)*MaxPerPage<totalPut then
rsArticle.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rsArticle.bookmark
call ArticleContent(TitleLen)
else
currentPage=1
call ArticleContent(TitleLen)
end if
end if
end if
rsArticle.close
set rsArticle=nothing
end sub

sub ArticleContent(intTitleLen)
dim i,strTemp
i=0
do while not rsArticle.eof
strTemp=""
'strTemp = strTemp & ""
strTemp= strTemp & "<table width=50% border=0 cellspacing=3 cellpadding=0>"
strTemp= strTemp & " <tr>"
strTemp= strTemp & " <td><table width=300 border=0 cellspacing=3 cellpadding=0>"
strTemp= strTemp & " <tr>"
strTemp= strTemp & " <td><div align=center><a href=ArticleShow.asp?ArticleID=" & rsArticle("articleid") & ">"
strTemp= strTemp & " <img border=0 src=" & rsArticle("DefaultPicUrl") & " width=200 height=150>&nbsp;&nbsp;&nbsp;&nbsp;"
strTemp= strTemp & " </a></div></td>"
strTemp= strTemp & " </tr>"
strTemp= strTemp & " </table>"
strTemp= strTemp & " <table width=250 border=0 align=center>"
strTemp= strTemp & " <tr>"
strTemp= strTemp & " <td width=30% align=right>"
strTemp= strTemp & " 产品名称:</td>"
strTemp= strTemp & " <td align=center>"
strTemp= strTemp & " <a href=ArticleShow.asp?ArticleID=" & rsArticle("articleid") & ">" & rsArticle("Title") & ""
strTemp= strTemp & " </a></td>"
strTemp= strTemp & "</tr><tr>"
strTemp= strTemp & " <td align=right>"
strTemp= strTemp & " 产品类型:</td>"
strTemp= strTemp & " <td align=center>"
strTemp= strTemp & " <a href=Product.asp?BigClassName=" & rsArticle("BigClassName") & ">" & rsArticle("BigClassName") & "</a>"
strTemp= strTemp & " <a href=Product.asp?BigClassName=" & rsArticle("BigClassName") & "&SmallClassName=" & rsArticle("SmallClassName") & ">" & rsArticle("SmallClassName") & ""
strTemp= strTemp & " </a></td>"
strTemp= strTemp & " </tr><tr>"
strTemp= strTemp & " <td align=right>产品信息:</td>"
strTemp= strTemp & " <td align=center>"
strTemp= strTemp & " <a href=ArticleShow.asp?ArticleID=" & rsArticle("articleid") & "><img src=Img/arrow_7.gif border=0></a></td>"
strTemp= strTemp & " </tr>"
strTemp= strTemp & "</table></td>"
strTemp= strTemp & " </tr>"
strTemp= strTemp & " </table>"

response.write strTemp
rsArticle.movenext
i=i+1
if i>=MaxPerPage then exit do
loop
end sub

搜索更多相关主题的帖子: 每行 数量 展示 
2006-12-31 23:08
champion1983
Rank: 1
等 级:新手上路
帖 子:75
专家分:0
注 册:2006-12-27
收藏
得分:0 

不知道你用表格作还是什么
我用表格作
判断<td>
dim td_num
td_num=0
if td_num mod 2=0 then
response.write "</tr><tr>"
end if


web designer & network engineer
2007-01-01 10:28
快速回复:产品展示限制每行数量谁能指点下
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025748 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved