| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 370 人关注过本帖
标题:条件语句问题
只看楼主 加入收藏
champion1983
Rank: 1
等 级:新手上路
帖 子:75
专家分:0
注 册:2006-12-27
收藏
 问题点数:0 回复次数:1 
条件语句问题

<!--PRO Begin-->
<%sql="select * from products"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write("Null")
else
rdcount=rs.recordcount
%>
<TABLE cellSpacing=0 cellPadding=0 width=190 border=0>
<TBODY>
<TR>
<%
dim tempstr
tempstr = -1
for i=1 to rdcount
if rs("type_id") <> tempstr then
tempstr = rs("type_id")
%>

<TD width=163>
<DIV align=center>
<TABLE cellSpacing=0 cellPadding=0 width="170" border=0>
<TBODY>
<TR>
<TD height=120 align="center"><A href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>"><%=rs("type_id")%></A>
<P align=center><A href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>"><IMG src="images/<%=rs("product_photo")%>" border=0 width=100></A></P></TD></TR>

<TR>
<TD height=25>
<P align=center><A class=small href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>">
<span style="font-size: 8pt; text-decoration: none"><%=rs("product_num")%></span></A></P></TD></TR>
<TR>
<TD> <TR>
<TD>
<table border="0" width=150 cellspacing="0" cellpadding="0" align=center>
<tr>
<td bgcolor="#000000" height=1></td>
</tr>
</table></TD>
</TR>
<TR>
<TD height=10></TD>
</TR><%
sql="select top 5 * from products where type_id='"&type_id&"' and product_id<>"&rs("product_id")&" order by product_date desc"
rs2.open sql,conn,1,1
rdcount2=rs2.recordcount
for j=1 to rdcount2
%>

<TR>
<TD height=20><IMG style="margin-left:10px" src="images/arrow_blk.gif" border=0><A class=navsublinks
href="prod_detail.asp?product_id=<%=rs2("product_id")%>&type_id=<%=replace(rs2("type_id"),"&","_")%>"><%=rs2("product_num")%></A></TD>
</TR>
<%
rs2.movenext
next
rs2.close
%>
<TR>
<TD height=20><IMG style="margin-left:10px" src="images/arrow_blk.gif" border=0><A href="prod.asp?product_id=<%=rs("product_id")%>&type_id=<%=replace(rs("type_id"),"&","_")%>"><img src="images/view_all.gif" border=0></A></TD>
</TR>
</TD></TR>
</TBODY></TABLE></DIV></TD>
<TD width=27 valign="top">
<table border="0" width="1" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height=140 align=center>
<tr>
<td bgcolor="#FFFFFF" width=1 height="7"></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</TD>

<%
end if

rs.movenext
if i mod 3 = 0 then response.write("</tr><tr><td height=30></td></tr><TR>")
next
end if
rs.close
%>
</TR>
</TBODY></TABLE>
<!--PRO End-->

现在这个页面如果同一个type_id的记录条数大于1,那么就会换行显示下一个type_id的内容
请问这一句if i mod 3 = 0 then response.write("</tr><tr><td height=30></td></tr><TR>")
如何调整,能够显示满3个type_id才换行
谢谢

搜索更多相关主题的帖子: 语句 条件 
2006-12-28 17:18
champion1983
Rank: 1
等 级:新手上路
帖 子:75
专家分:0
注 册:2006-12-27
收藏
得分:0 
已经解决了~

web designer & network engineer
2006-12-28 19:45
快速回复:条件语句问题
数据加载中...
 
   



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

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