do while not rs.eof问题
下面代码是显示小于8行为一列,现在我想显示为二列都为8行的,该如何改一下!!<%Setrs_news=Server.CreateObject("Adodb.Records...
下面代码是显示小于8行为一列,现在我想显示为二列都为8行的,该如何改一下!!<%
Set rs_news=Server.CreateObject("Adodb.Recordset")
rs_news.open "select top 8 * from all_news where s_id=7 order by sendtime desc",conn,1,3
'i=1
do while not rs_news.eof and i<=8
if len(rs_news("title")) > 10 then '判断字符串的长度
ttt= left(rs_news("title"),29)&" ..."
else
ttt= rs_news("title")
end if
%>
<li> <a href="news_c.asp?id=<%=rs_news("id")%>" title="<%=rs_news("title")%>"><%=rs_news("title")%></li>
<%
i=i+1
rs_news.movenext
loop
%> 展开
Set rs_news=Server.CreateObject("Adodb.Recordset")
rs_news.open "select top 8 * from all_news where s_id=7 order by sendtime desc",conn,1,3
'i=1
do while not rs_news.eof and i<=8
if len(rs_news("title")) > 10 then '判断字符串的长度
ttt= left(rs_news("title"),29)&" ..."
else
ttt= rs_news("title")
end if
%>
<li> <a href="news_c.asp?id=<%=rs_news("id")%>" title="<%=rs_news("title")%>"><%=rs_news("title")%></li>
<%
i=i+1
rs_news.movenext
loop
%> 展开
1个回答
2013-07-13
展开全部
这样试试,<ul>的css自己定义:<%
Set rs_news=Server.CreateObject("Adodb.Recordset")
rs_news.open "select top 16 * from all_news where s_id=7 order by sendtime desc",conn,1,3
dim i
i=0
response.write "<ul style='float:left'>"
do while not rs_news.eof and i<16
i=i+1
if len(rs_news("title")) > 10 then '判断字符串的长度
ttt= left(rs_news("title"),9)&" ..."
else
ttt= rs_news("title")
end if
%>
<li><a href="news_c.asp?id=<%=rs_news("id")%>" title="<%=rs_news("title")%>"><%=ttt%></a></li>
<%
if i=8 then response.write "</ul><ul style='float:left'>"
rs_news.movenext
loop
response.write "</ul>"
%>
Set rs_news=Server.CreateObject("Adodb.Recordset")
rs_news.open "select top 16 * from all_news where s_id=7 order by sendtime desc",conn,1,3
dim i
i=0
response.write "<ul style='float:left'>"
do while not rs_news.eof and i<16
i=i+1
if len(rs_news("title")) > 10 then '判断字符串的长度
ttt= left(rs_news("title"),9)&" ..."
else
ttt= rs_news("title")
end if
%>
<li><a href="news_c.asp?id=<%=rs_news("id")%>" title="<%=rs_news("title")%>"><%=ttt%></a></li>
<%
if i=8 then response.write "</ul><ul style='float:left'>"
rs_news.movenext
loop
response.write "</ul>"
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询