(高手)asp数据如何分两列显示
<%setrs_news=server.createobject("adodb.recordset")sqltext4="selecttop8*fromnewswhere...
<%
set rs_news=server.createobject("adodb.recordset")
sqltext4="select top 8 * from news where BigClassName='公司新闻' order by id desc"
rs_news.open sqltext4,conn,1,1
%>
<table class=newstitle style="MARGIN-TOP: 6px" cellspacing=0 cellpadding=0
width=461 border=0>
<tbody>
<%i=0
do while not rs_news.eof%>
<tr>
<td width=317 height=26><a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank"><font color="#6f6f6f"><%=cutstr(rs_news("title"),22)%></font></a></td>
<td class=newstime width=125 height=26><span style="color: #bbbbbb"><%=rs_news("adddate")%></span></td>
</tr>
<%rs_news.movenext
i=i+1
if i=8 then exit do
loop
rs_news.close %>
<tr> 展开
set rs_news=server.createobject("adodb.recordset")
sqltext4="select top 8 * from news where BigClassName='公司新闻' order by id desc"
rs_news.open sqltext4,conn,1,1
%>
<table class=newstitle style="MARGIN-TOP: 6px" cellspacing=0 cellpadding=0
width=461 border=0>
<tbody>
<%i=0
do while not rs_news.eof%>
<tr>
<td width=317 height=26><a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank"><font color="#6f6f6f"><%=cutstr(rs_news("title"),22)%></font></a></td>
<td class=newstime width=125 height=26><span style="color: #bbbbbb"><%=rs_news("adddate")%></span></td>
</tr>
<%rs_news.movenext
i=i+1
if i=8 then exit do
loop
rs_news.close %>
<tr> 展开
3个回答
展开全部
已经是两列了呀,一列显示cutstr(rs_news("title"),22);一列显示rs_news("adddate");
如果你是想4列显示的话;
<%i=0
do while not rs_news.eof%>
<tr>
<td width=317 height=26><a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank"><font color="#6f6f6f"><%=cutstr(rs_news("title"),22)%></font></a></td>
<td class=newstime width=125 height=26><span style="color: #bbbbbb"><%=rs_news("adddate")%></span></td>
<% if i mod 2 <> 0 then response.write(" </tr>")
rs_news.movenext
i=i+1
如果你是想4列显示的话;
<%i=0
do while not rs_news.eof%>
<tr>
<td width=317 height=26><a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank"><font color="#6f6f6f"><%=cutstr(rs_news("title"),22)%></font></a></td>
<td class=newstime width=125 height=26><span style="color: #bbbbbb"><%=rs_news("adddate")%></span></td>
<% if i mod 2 <> 0 then response.write(" </tr>")
rs_news.movenext
i=i+1
展开全部
<%
set rs_news=server.createobject("adodb.recordset")
sqltext4="select top 8 * from news where BigClassName='公司新闻' order by id desc"
rs_news.open sqltext4,conn,1,1
%>
<table class=newstitle style="MARGIN-TOP: 6px" cellspacing=0 cellpadding=0
width=461 border=0>
<tbody>
<%do while not rs_news.eof%>
<tr>
<%
i = 0
Do WHILE i <> 2 AND not rs_news.eof%>
<td width=317 height=26><a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank"><font color="#6f6f6f"><%=cutstr(rs_news("title"),22)%></font></a></td>
<td class=newstime width=125 height=26><span style="color: #bbbbbb"><%=rs_news("adddate")%></span></td>
</tr>
<%rs_news.movenext
i = i + 1
loop
%>
</tr>
<%loop
rs_news.close
%>
set rs_news=server.createobject("adodb.recordset")
sqltext4="select top 8 * from news where BigClassName='公司新闻' order by id desc"
rs_news.open sqltext4,conn,1,1
%>
<table class=newstitle style="MARGIN-TOP: 6px" cellspacing=0 cellpadding=0
width=461 border=0>
<tbody>
<%do while not rs_news.eof%>
<tr>
<%
i = 0
Do WHILE i <> 2 AND not rs_news.eof%>
<td width=317 height=26><a href="shownews.asp?id=<%=rs_news("id")%>" target="_blank"><font color="#6f6f6f"><%=cutstr(rs_news("title"),22)%></font></a></td>
<td class=newstime width=125 height=26><span style="color: #bbbbbb"><%=rs_news("adddate")%></span></td>
</tr>
<%rs_news.movenext
i = i + 1
loop
%>
</tr>
<%loop
rs_news.close
%>
更多追问追答
追问
还是显示不了啊
追答
还是1列?还是现实不出内容?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这是全部代码吗?十有八九是html标签嵌套错误,你仔细注意一下那个tbody和那些tr
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询