<ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
%>
<li ><%=rs("newsTitle")%></li>
<%
rs.movenext
loop
rs.close
%>
</ul>
9 个解决方案
#1
<ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
newsTitle=rs("newsTitle")
rs.movenext
if rs.eof then
%>
<li style="color:#ff0000"><%=newsTitle%></li>
<%
else
%>
<li style="color:#0000ff"><%=newsTitle%></li>
<%
loop
rs.close
%>
</ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
newsTitle=rs("newsTitle")
rs.movenext
if rs.eof then
%>
<li style="color:#ff0000"><%=newsTitle%></li>
<%
else
%>
<li style="color:#0000ff"><%=newsTitle%></li>
<%
loop
rs.close
%>
</ul>
#2
loop哪里提示缺少do
#3
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if
i=0
do while not es.eof
i=i+1
if rs.absoluteposition=rs.recordcount then'如果记录集当前的指针所在记录已经等于记录集最大数
response.write"<li style="color:#FF0000">"&rs("newsTitle")&"</li>"'红色字体
end if
response.write "<li style="color:#0033FF">"&rs("newsTitle")&"</li>"'蓝色字体
rs.movenext
loop
rs.close
set rs=nothing
#4
loop前面一行加上end if
#5
end if 的位置不对,把三楼的调整一下如下:
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if '这里的END IF 调到后面,这里改成ELSE
i=0
do while not es.eof
i=i+1
if rs.absoluteposition=rs.recordcount then'如果记录集当前的指针所在记录已经等于记录集最大数
response.write"<li style="color:#FF0000">"&rs("newsTitle")&"</li>"'红色字体
end if
response.write "<li style="color:#0033FF">"&rs("newsTitle")&"</li>"'蓝色字体
rs.movenext
loop
END IF ’在这里加上END IF
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if '这里的END IF 调到后面,这里改成ELSE
i=0
do while not es.eof
i=i+1
if rs.absoluteposition=rs.recordcount then'如果记录集当前的指针所在记录已经等于记录集最大数
response.write"<li style="color:#FF0000">"&rs("newsTitle")&"</li>"'红色字体
end if
response.write "<li style="color:#0033FF">"&rs("newsTitle")&"</li>"'蓝色字体
rs.movenext
loop
END IF ’在这里加上END IF
rs.close
set rs=nothing
#6
style这里提示语句未完成
#7
<ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
%><%
<li style="color:red"><%=rs("newsTitle")%></li>
%>
<li style="color:red"><%=rs("newsTitle")%></li>
<%
rs.movenext
loop
rs.close
%>
</ul>
#8
你们都理解错了我的意思,我是说最后一条记录字体为红色,也就是说id最大的那条
#9
这样3楼的帖子更改如下:
<ul>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if
i=0
do while not rs.eof 'es改为rs
i=i+1
if rs.absoluteposition=1 then'因为id最大,而asp指针从最大的开始,所以等于1
response.write"<li style='color:#FF0000'>"&rs("newsTitle")&"</li>"
else'更改为else
response.write "<li style='color:#0033FF'>"&rs("newsTitle")&"</li>"
end if'添加end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</ul>
#1
<ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
newsTitle=rs("newsTitle")
rs.movenext
if rs.eof then
%>
<li style="color:#ff0000"><%=newsTitle%></li>
<%
else
%>
<li style="color:#0000ff"><%=newsTitle%></li>
<%
loop
rs.close
%>
</ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
newsTitle=rs("newsTitle")
rs.movenext
if rs.eof then
%>
<li style="color:#ff0000"><%=newsTitle%></li>
<%
else
%>
<li style="color:#0000ff"><%=newsTitle%></li>
<%
loop
rs.close
%>
</ul>
#2
loop哪里提示缺少do
#3
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if
i=0
do while not es.eof
i=i+1
if rs.absoluteposition=rs.recordcount then'如果记录集当前的指针所在记录已经等于记录集最大数
response.write"<li style="color:#FF0000">"&rs("newsTitle")&"</li>"'红色字体
end if
response.write "<li style="color:#0033FF">"&rs("newsTitle")&"</li>"'蓝色字体
rs.movenext
loop
rs.close
set rs=nothing
#4
loop前面一行加上end if
#5
end if 的位置不对,把三楼的调整一下如下:
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if '这里的END IF 调到后面,这里改成ELSE
i=0
do while not es.eof
i=i+1
if rs.absoluteposition=rs.recordcount then'如果记录集当前的指针所在记录已经等于记录集最大数
response.write"<li style="color:#FF0000">"&rs("newsTitle")&"</li>"'红色字体
end if
response.write "<li style="color:#0033FF">"&rs("newsTitle")&"</li>"'蓝色字体
rs.movenext
loop
END IF ’在这里加上END IF
rs.close
set rs=nothing
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if '这里的END IF 调到后面,这里改成ELSE
i=0
do while not es.eof
i=i+1
if rs.absoluteposition=rs.recordcount then'如果记录集当前的指针所在记录已经等于记录集最大数
response.write"<li style="color:#FF0000">"&rs("newsTitle")&"</li>"'红色字体
end if
response.write "<li style="color:#0033FF">"&rs("newsTitle")&"</li>"'蓝色字体
rs.movenext
loop
END IF ’在这里加上END IF
rs.close
set rs=nothing
#6
style这里提示语句未完成
#7
<ul>
<%set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then%>
<li class="current">暂无信息</li>
<%
end if
i=0
do while not rs.eof
i=i+1
%><%
<li style="color:red"><%=rs("newsTitle")%></li>
%>
<li style="color:red"><%=rs("newsTitle")%></li>
<%
rs.movenext
loop
rs.close
%>
</ul>
#8
你们都理解错了我的意思,我是说最后一条记录字体为红色,也就是说id最大的那条
#9
这样3楼的帖子更改如下:
<ul>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select top 8 * from news order by id desc",conn,1,1
if rs.eof then
response.write "暂无信息"
end if
i=0
do while not rs.eof 'es改为rs
i=i+1
if rs.absoluteposition=1 then'因为id最大,而asp指针从最大的开始,所以等于1
response.write"<li style='color:#FF0000'>"&rs("newsTitle")&"</li>"
else'更改为else
response.write "<li style='color:#0033FF'>"&rs("newsTitle")&"</li>"
end if'添加end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</ul>