请求asp中行列输出的问题
下面一段代码,我想生成的效果是:四行四列我始终做不起来,都弄了小一天了,希望哪位高手帮个忙,不甚至感激,在线等......<tablewidth="390"height=...
下面一段代码,我想生成的效果是:四行四列
我始终做不起来,都弄了小一天了,希望哪位高手帮个忙,不甚至感激,在线等......
<table width="390" height="300" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #DD988F;">
<tr>
<td style="padding-top:4px;border-left:1px #cccccc solid;border-right:1px #cccccc solid;border-bottom:1px #cccccc solid;">
<div id="sca_gy" style="width:160px;height:440px;overflow:hidden;">
<%
set rs=server.createobject("adodb.recordset")
sql="select top 16 * from SMT_cp where SMT_key=1 and SMT_key1=1 and SMT_key2=1 and SMT_key3=1 order by SMT_id desc"
rs.open sql,conn,1,1
do while not rs.eof
cpname=rs("SMT_cpname")
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td height=90 align=center><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><img src="<%=rs("SMT_pic")%>" border="0" width=80 height=80 style="border:2px #dddddd solid;" alt="<%=cpname%>"></a>
<div style="height:20px;width:100%;line-height:18px;text-align:center;padding-left:10px;font-size:12px;font-weight:bold;padding-bottom:2px;"><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><%=LeftT(cpname,20)%></a></div>
</td></tr>
</table>
<%
rs.movenext
loop
rs.close
%>
</div>
<br style="line-height:7px;">
</td>
</tr>
</table> 展开
我始终做不起来,都弄了小一天了,希望哪位高手帮个忙,不甚至感激,在线等......
<table width="390" height="300" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #DD988F;">
<tr>
<td style="padding-top:4px;border-left:1px #cccccc solid;border-right:1px #cccccc solid;border-bottom:1px #cccccc solid;">
<div id="sca_gy" style="width:160px;height:440px;overflow:hidden;">
<%
set rs=server.createobject("adodb.recordset")
sql="select top 16 * from SMT_cp where SMT_key=1 and SMT_key1=1 and SMT_key2=1 and SMT_key3=1 order by SMT_id desc"
rs.open sql,conn,1,1
do while not rs.eof
cpname=rs("SMT_cpname")
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td height=90 align=center><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><img src="<%=rs("SMT_pic")%>" border="0" width=80 height=80 style="border:2px #dddddd solid;" alt="<%=cpname%>"></a>
<div style="height:20px;width:100%;line-height:18px;text-align:center;padding-left:10px;font-size:12px;font-weight:bold;padding-bottom:2px;"><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><%=LeftT(cpname,20)%></a></div>
</td></tr>
</table>
<%
rs.movenext
loop
rs.close
%>
</div>
<br style="line-height:7px;">
</td>
</tr>
</table> 展开
1个回答
展开全部
<table width="390" height="300" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #DD988F;">
<tr>
<td style="padding-top:4px;border-left:1px #cccccc solid;border-right:1px #cccccc solid;border-bottom:1px #cccccc solid;">
<div id="sca_gy" style="width:160px;height:440px;overflow:hidden;">
<%
set rs=server.createobject("adodb.recordset")
sql="select top 16 * from SMT_cp where SMT_key=1 and SMT_key1=1 and SMT_key2=1 and SMT_key3=1 order by SMT_id desc"
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
i=0
do while not rs.eof
cpname=rs("SMT_cpname")
i=i+1
%>
<td height=90 align=center>
<a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank">
<img src="<%=rs("SMT_pic")%>" border="0" width=80 height=80 style="border:2px #dddddd solid;" alt="<%=cpname%>">
</a>
<div style="height:20px;width:100%;line-height:18px;text-align:center;padding-left:10px;font-size:12px;font-weight:bold;padding-bottom:2px;"><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><%=LeftT(cpname,20)%></a></div>
</td>
<%
if i mod 4=0 then response.write "</tr><tr>"
end if
rs.movenext
loop
%>
</tr>
</table>
rs.close
%>
</div>
<br style="line-height:7px;">
</td>
</tr>
</table>
以后代码写工整一点
太乱的我都懒得看了
<tr>
<td style="padding-top:4px;border-left:1px #cccccc solid;border-right:1px #cccccc solid;border-bottom:1px #cccccc solid;">
<div id="sca_gy" style="width:160px;height:440px;overflow:hidden;">
<%
set rs=server.createobject("adodb.recordset")
sql="select top 16 * from SMT_cp where SMT_key=1 and SMT_key1=1 and SMT_key2=1 and SMT_key3=1 order by SMT_id desc"
rs.open sql,conn,1,1
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<%
i=0
do while not rs.eof
cpname=rs("SMT_cpname")
i=i+1
%>
<td height=90 align=center>
<a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank">
<img src="<%=rs("SMT_pic")%>" border="0" width=80 height=80 style="border:2px #dddddd solid;" alt="<%=cpname%>">
</a>
<div style="height:20px;width:100%;line-height:18px;text-align:center;padding-left:10px;font-size:12px;font-weight:bold;padding-bottom:2px;"><a href=cp_view.asp?id=<%=rs("SMT_id")%> target="_blank"><%=LeftT(cpname,20)%></a></div>
</td>
<%
if i mod 4=0 then response.write "</tr><tr>"
end if
rs.movenext
loop
%>
</tr>
</table>
rs.close
%>
</div>
<br style="line-height:7px;">
</td>
</tr>
</table>
以后代码写工整一点
太乱的我都懒得看了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询