请问下面ASP代码怎么修改才能实现大表格里输出四个小表格之后自动换行,再输出另外四个?
<tablewidth="710"cellpadding="0"cellspacing="0"border="0"><tr><tdwidth="710"align="ce...
<table width="710" cellpadding="0" cellspacing="0" border="0">
<tr><td width="710" align="center" valign="middle" id="butong_left1"> <table width="100%" border="0" cellspacing="0" cellpadding="00">
<tr>
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from article where bigclassname in ('150','156') and passed=true order by articleid desc",conn,1,1
if not rs.eof then
do while not rs.eof %>
<td>
<table width="179" border="00" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="179" height="135" align="center"><table width="169" height="135" border="00" cellpadding="0" cellspacing="0" background="images/cpbg.gif">
<tr>
<td align="center">
<a href="content1.asp?id=<%=rs("articleid")%>&bg=<%=rs("bigclassname")%>"><img src="<%=rs("uploadfiles")%>" width="153" height="117" border="0" />
</a>
</td>
</tr>
</table></td>
</tr>
</table>
</td><%rs.movenext
loop
end if
rs.close%>
</tr>
</table>
<td width="0" valign="top" id="butong_left2"></td>
</tr>
</table> 展开
<tr><td width="710" align="center" valign="middle" id="butong_left1"> <table width="100%" border="0" cellspacing="0" cellpadding="00">
<tr>
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from article where bigclassname in ('150','156') and passed=true order by articleid desc",conn,1,1
if not rs.eof then
do while not rs.eof %>
<td>
<table width="179" border="00" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="179" height="135" align="center"><table width="169" height="135" border="00" cellpadding="0" cellspacing="0" background="images/cpbg.gif">
<tr>
<td align="center">
<a href="content1.asp?id=<%=rs("articleid")%>&bg=<%=rs("bigclassname")%>"><img src="<%=rs("uploadfiles")%>" width="153" height="117" border="0" />
</a>
</td>
</tr>
</table></td>
</tr>
</table>
</td><%rs.movenext
loop
end if
rs.close%>
</tr>
</table>
<td width="0" valign="top" id="butong_left2"></td>
</tr>
</table> 展开
1个回答
展开全部
思路是,rs集里有8个图,先循环输出4个图,输出换行,再循环输出剩下4个图。框体大小什么的,你自己改改吧。
如果是要在同一个表里循环输出,也可以。建立一个2行4列的表,把4列改成循环。希望可以帮助你。
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from article where bigclassname in ('150','156') and passed=true order by articleid desc",conn,1,1
if not rs.eof then
for i=0 to 3 %>
<table width="200" border="0">
<tr>
<td><a href="content1.asp?id=<%=rs("articleid")%>&bg=<%=rs("bigclassname")%>"><img src="<%=rs("uploadfiles")%>" width="153" height="117" border="0" /></a> </td>
</tr>
</table>
<%rs.movenext
next
end if
%>
<br>
<% for i=0 to 3 %>
<table width="200" border="0">
<tr>
<td><a href="content1.asp?id=<%=rs("articleid")%>&bg=<%=rs("bigclassname")%>"><img src="<%=rs("uploadfiles")%>" width="153" height="117" border="0" /></a> </td>
</tr>
</table>
<%rs.movenext
next
rs.close
set rs=nothing
%>
如果是要在同一个表里循环输出,也可以。建立一个2行4列的表,把4列改成循环。希望可以帮助你。
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select top 8 * from article where bigclassname in ('150','156') and passed=true order by articleid desc",conn,1,1
if not rs.eof then
for i=0 to 3 %>
<table width="200" border="0">
<tr>
<td><a href="content1.asp?id=<%=rs("articleid")%>&bg=<%=rs("bigclassname")%>"><img src="<%=rs("uploadfiles")%>" width="153" height="117" border="0" /></a> </td>
</tr>
</table>
<%rs.movenext
next
end if
%>
<br>
<% for i=0 to 3 %>
<table width="200" border="0">
<tr>
<td><a href="content1.asp?id=<%=rs("articleid")%>&bg=<%=rs("bigclassname")%>"><img src="<%=rs("uploadfiles")%>" width="153" height="117" border="0" /></a> </td>
</tr>
</table>
<%rs.movenext
next
rs.close
set rs=nothing
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询