如何用ASP,让数据分两列显示?
<divalign="center"><tableborder="0"width="400"cellspacing="0"cellpadding="0"id="table...
<div align="center">
<table border="0" width="400" cellspacing="0" cellpadding="0" id="table13" height="48">
<tr>
<td height="24" width="400" align="left" valign="top">
<%
dim tupian
set rs = server.CreateObject("ADODB.RecordSet")
SQLStr = "select top 7 * from info where bt <> '' and lmmc = '国际新闻' order by id desc"
rs.open SQLStr, conn, 1, 1
do while not rs.eof
tupian=rs("D_SaveFileName")
%>
<table border="0" width="320" cellspacing="0" cellpadding="0" height="23" id="table13">
<tr><td width="320" height="23">
<table border="0" width="399" cellspacing="0" cellpadding="0" height="23">
<tr>
<td width="20" align="left" height="23"><img src="images/b.gif" border="0" width="11" height="11"></td>
<td align="left" width="304" valign="bottom" height="23"><a href="gjxw_show.asp?id=<%=rs("id")%>" target="_blank" title="<%=rs("bt")%>"><span class="font2"><%=btview(rs("bt"), 18)%></span>
</tr> </tr>
</table>
</td></tr>
<tr><td height="1" width="320" background="images/line.gif"></td></tr>
</table>
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</td>
</tr>
<tr>
<td align="center" width="400" height="24" valign="bottom">
<a href="gjxwindex.asp"><font class="font9">更多...</font></a></td>
</tr>
</table>
</div> 展开
<table border="0" width="400" cellspacing="0" cellpadding="0" id="table13" height="48">
<tr>
<td height="24" width="400" align="left" valign="top">
<%
dim tupian
set rs = server.CreateObject("ADODB.RecordSet")
SQLStr = "select top 7 * from info where bt <> '' and lmmc = '国际新闻' order by id desc"
rs.open SQLStr, conn, 1, 1
do while not rs.eof
tupian=rs("D_SaveFileName")
%>
<table border="0" width="320" cellspacing="0" cellpadding="0" height="23" id="table13">
<tr><td width="320" height="23">
<table border="0" width="399" cellspacing="0" cellpadding="0" height="23">
<tr>
<td width="20" align="left" height="23"><img src="images/b.gif" border="0" width="11" height="11"></td>
<td align="left" width="304" valign="bottom" height="23"><a href="gjxw_show.asp?id=<%=rs("id")%>" target="_blank" title="<%=rs("bt")%>"><span class="font2"><%=btview(rs("bt"), 18)%></span>
</tr> </tr>
</table>
</td></tr>
<tr><td height="1" width="320" background="images/line.gif"></td></tr>
</table>
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</td>
</tr>
<tr>
<td align="center" width="400" height="24" valign="bottom">
<a href="gjxwindex.asp"><font class="font9">更多...</font></a></td>
</tr>
</table>
</div> 展开
3个回答
展开全部
现在已经不流行 if i mod 2 = 0 then 这样写法了,直接用DIV+CSS轻松搞定。
首先要用到
如两列:
<div style="width:120px; ">
<ul>
<%do while not rs.eof%>
<li style="float:left;width:60px;list-style:none;"><%=rs("bt")%></li> ----- 这里宽度width:60px 是div宽度的2分之1
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</ul>
</div>
如三列:
<div style="width:120px; ">
<ul>
<%do while not rs.eof%>
<li style="float:left;width:40px;list-style:none;"><%=rs("bt")%></li> ----- 这里宽度width:40px 是div宽度的3分之1
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</ul>
</div>
--------------利用DIV标签宽度来排列。
首先要用到
如两列:
<div style="width:120px; ">
<ul>
<%do while not rs.eof%>
<li style="float:left;width:60px;list-style:none;"><%=rs("bt")%></li> ----- 这里宽度width:60px 是div宽度的2分之1
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</ul>
</div>
如三列:
<div style="width:120px; ">
<ul>
<%do while not rs.eof%>
<li style="float:left;width:40px;list-style:none;"><%=rs("bt")%></li> ----- 这里宽度width:40px 是div宽度的3分之1
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</ul>
</div>
--------------利用DIV标签宽度来排列。
展开全部
dim i
i = 1
do while not rs.eof
.............
if i mod 2 = 0 then
'输出tr
else
'输出td
end if
i=i+1
loop
i = 1
do while not rs.eof
.............
if i mod 2 = 0 then
'输出tr
else
'输出td
end if
i=i+1
loop
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
现在都用建站后台了,不用自己改代码。所见即所得的编辑方式。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询