ASP中一行5个图片 如何分2行或者3行显示
如下面的代码:现在是一行5个图片如何分2行活3行每行5个!<table><tr><%setrs=server.CreateObject("adodb.recordset"...
如下面的代码:现在是一行5个图片 如何分2行活3行 每行5个!
<table>
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select top 5 * from news where Bigclassname='产品展示' and ok=true"
rs.open sql,conn,3,2
do while not rs.eof
%>
<td align="center" width="155">
<table width="140">
<tr>
<td height="117" align="center" width="135"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><img src="<%=rs("small_photo")%>" width="135" height="136" border="0" /></a></td>
</tr>
<tr>
<td height="27" align="center" class="STYLE9"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><%=rs("title")%></a></td>
</tr>
</table> </td>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
谢谢1楼的回答 我要定死只能2行或者3行 代码变哪里? 展开
<table>
<tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select top 5 * from news where Bigclassname='产品展示' and ok=true"
rs.open sql,conn,3,2
do while not rs.eof
%>
<td align="center" width="155">
<table width="140">
<tr>
<td height="117" align="center" width="135"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><img src="<%=rs("small_photo")%>" width="135" height="136" border="0" /></a></td>
</tr>
<tr>
<td height="27" align="center" class="STYLE9"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><%=rs("title")%></a></td>
</tr>
</table> </td>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
谢谢1楼的回答 我要定死只能2行或者3行 代码变哪里? 展开
1个回答
展开全部
<table>
<tr>
<%
i=0
set rs=server.CreateObject("adodb.recordset")
sql="select * from news where Bigclassname='产品展示' and ok=true"
rs.open sql,conn,3,2
do while not rs.eof and i<=15 '==================这里设置限制
i=i+1
%>
<td align="center" width="155">
<table width="140">
<tr>
<td height="117" align="center" width="135"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><img src="<%=rs("small_photo")%>" width="135" height="136" border="0" /></a></td>
</tr>
<tr>
<td height="27" align="center" class="STYLE9"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><%=rs("title")%></a></td>
</tr>
</table> </td>
<%
if i mod 5=0 then
response.write "</tr><tr>"
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
<tr>
<%
i=0
set rs=server.CreateObject("adodb.recordset")
sql="select * from news where Bigclassname='产品展示' and ok=true"
rs.open sql,conn,3,2
do while not rs.eof and i<=15 '==================这里设置限制
i=i+1
%>
<td align="center" width="155">
<table width="140">
<tr>
<td height="117" align="center" width="135"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><img src="<%=rs("small_photo")%>" width="135" height="136" border="0" /></a></td>
</tr>
<tr>
<td height="27" align="center" class="STYLE9"><a href="news_info.asp?nid=<%=rs("id")%>&bigclassname=<%=rs("bigclassname")%>" class="l9"><%=rs("title")%></a></td>
</tr>
</table> </td>
<%
if i mod 5=0 then
response.write "</tr><tr>"
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</tr>
</table>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询