asp 如何将商品分列显示?望高手指教!

来源:百度知道 编辑:UC知道 时间:2024/05/24 18:32:00
我的代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->
<head>
<title>products</title>
</head>
<% i=0
set rs=conn.execute("select * from products where hp='true')
while not rs.eof and i<15
%>
<body>
<table>
<tr>
<td rowspan="2"><img src="pimg/<%=rs("picture1")%>" width="100" height="150" /></td>
<% if i mod 3=0 then response.Write("</tr><tr>") end if%>
<%i=i+1
rs.movenext
wend %>
</tr>
</table>
</body>
</html>
<%rs.close%>

补充:此代码不能分列 头痛~ 希望大家能帮帮我! 谢谢!
我想要实现的效果试一页只显示15个 每行3个

table标签的位置不对,判断也要改一下,具体代码如下

<%
i=0
Set rs=conn.execute("select * from products where hp='true'")
%>
<body>
<table>
<%
while not rs.eof and i<15
if i mod 3=0 then
response.Write("<tr>")
end if
%>
<td>
<img src="pimg/<%=rs("picture1")%>" width="100" height="150" />
</td>
<%
if i mod 3=2 then
response.Write("</tr>")
end if
i=i+1
rs.movenext
wend %>
</table>
</body>
</html>
<%
rs.close
%>

sql:要打开数据的查询语句
rows:行数
cols:列数
ipage:显示第几页的数据
isShowBookMark:是否显示书签,如果你使用此函数显示于首页上,设置0--不显示
<%
sub showNews(sql,rows,cols,ipage,isShowBookMark,autoLen)
dim rs,page_size,icol,path
i