asp程序 将图片显示为三列然后自动转到下一行
现在这个是一行显示一张图然后转到下一行,如何才能变为显示三张图片后转到一行显示.<%i=0sql="selecttop3id,title,picflag,content,...
现在这个是一行显示一张图然后转到下一行,如何才能变为显示三张图片后转到一行显示.
<%
i=0
sql="select top 3 id,title,picflag,content,creatdate from product3 where cnflag=1 and tjflag=1 order by editdate desc,id"
rs.open sql,cn,1,1
do while not rs.eof
'url="product_info.asp?prono="&rs("id")&""" target=""_blank"
url="view.asp?prono="&rs("id")&""" target=""_blank"
%>
<%if i=1 then%>
<table width="12%" border="0" cellspacing="0" cellpadding="00">
<tr>
<td height="7" align="center" background="images/line_point3.gif"></td>
</tr>
</table>
<%end if%>
<table width="12%" border="0" cellpadding="0" cellspacing="0" class="font">
<tr>
<td width="119" height="72" valign="top">
<div align="center">
<table width="90" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="70" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="100" height="80" border="0"></a></td>
<%else%>
<td width="90" height="70" align="center" bgcolor="ffffff"><font color=666666>
暂无图片</font></td>
<%end if%>
</tr>
</table>
</div>
</td>
</tr>
</table>
<%
i=1
rs.movenext
loop
rs.close
%> 展开
<%
i=0
sql="select top 3 id,title,picflag,content,creatdate from product3 where cnflag=1 and tjflag=1 order by editdate desc,id"
rs.open sql,cn,1,1
do while not rs.eof
'url="product_info.asp?prono="&rs("id")&""" target=""_blank"
url="view.asp?prono="&rs("id")&""" target=""_blank"
%>
<%if i=1 then%>
<table width="12%" border="0" cellspacing="0" cellpadding="00">
<tr>
<td height="7" align="center" background="images/line_point3.gif"></td>
</tr>
</table>
<%end if%>
<table width="12%" border="0" cellpadding="0" cellspacing="0" class="font">
<tr>
<td width="119" height="72" valign="top">
<div align="center">
<table width="90" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="70" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="100" height="80" border="0"></a></td>
<%else%>
<td width="90" height="70" align="center" bgcolor="ffffff"><font color=666666>
暂无图片</font></td>
<%end if%>
</tr>
</table>
</div>
</td>
</tr>
</table>
<%
i=1
rs.movenext
loop
rs.close
%> 展开
展开全部
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<Tr><%
i=1
sql="select top 3 id,title,picflag,content,creatdate from product3 where cnflag=1 and tjflag=1 order by editdate desc,id"
rs.open sql,cn,1,1
do while not rs.eof
'url="product_info.asp?prono="&rs("id")&""" target=""_blank"
url="view.asp?prono="&rs("id")&""" target=""_blank"
%>
<TD>
<table width="12%" border="0" cellspacing="0" cellpadding="00">
<tr>
<td height="7" align="center" background="images/line_point3.gif"></td>
</tr>
</table>
<table width="12%" border="0" cellpadding="0" cellspacing="0" class="font">
<tr>
<td width="119" height="72" valign="top">
<div align="center">
<table width="90" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="70" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="100" height="80" border="0"></a></td>
<%else%>
<td width="90" height="70" align="center" bgcolor="ffffff"><font color=666666>
暂无图片</font></td>
<%end if%>
</tr>
</table>
</div>
</td>
</tr>
</table> </td>
<%
if i=rs.recordcount then '当最后一条记录行结束
response.write "</tr>"
else
if (i mod 3)=0 then response.write "</tr><Tr>" '被三整除的换行,就是当三列自动转到下行
end if
i=i+1
rs.movenext
loop
rs.close
%>
</table>
<Tr><%
i=1
sql="select top 3 id,title,picflag,content,creatdate from product3 where cnflag=1 and tjflag=1 order by editdate desc,id"
rs.open sql,cn,1,1
do while not rs.eof
'url="product_info.asp?prono="&rs("id")&""" target=""_blank"
url="view.asp?prono="&rs("id")&""" target=""_blank"
%>
<TD>
<table width="12%" border="0" cellspacing="0" cellpadding="00">
<tr>
<td height="7" align="center" background="images/line_point3.gif"></td>
</tr>
</table>
<table width="12%" border="0" cellpadding="0" cellspacing="0" class="font">
<tr>
<td width="119" height="72" valign="top">
<div align="center">
<table width="90" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
<tr>
<%if rs("picflag")=1 then%>
<td width="90" height="70" align="center" bgcolor="ffffff"><a href="<%=url%>"><img src="./myasp_pic_display.asp?tablename=product3&code=&keyno=<%=rs("id")%>" width="100" height="80" border="0"></a></td>
<%else%>
<td width="90" height="70" align="center" bgcolor="ffffff"><font color=666666>
暂无图片</font></td>
<%end if%>
</tr>
</table>
</div>
</td>
</tr>
</table> </td>
<%
if i=rs.recordcount then '当最后一条记录行结束
response.write "</tr>"
else
if (i mod 3)=0 then response.write "</tr><Tr>" '被三整除的换行,就是当三列自动转到下行
end if
i=i+1
rs.movenext
loop
rs.close
%>
</table>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询