如何在数据库中提取的前十条记录中再让前三条显示为红色?

wl0618 2006-08-14 09:39:09
请各位指教,如何在数据库中提取的前十条记录中再让前三条显示为红色?

本网站是根据青创在线改编的,它本身有提取数据库前十条记录的功能,但是领导还想让其中的前三条显示为红色,请问该如何实现?

附源码:
<%Call Qcdn.Toplist("10","Unid",1)%> 此为调用语句,提取前十条记录

以下为toplist过程
<%
Public Sub Toplist(num,field,id)
if num = "" or field = "" then exit Sub
if field = "week" then
SqlT="SELECT top "& num &" Unid,Title,Nclassid,classid,pic FROM article_info where flag = 0 and DateDiff('d',intime,date())<=7 and Audit = 0 order by hits desc,title"
else
SqlT = "Select top "& num &" Unid,Title,Nclassid,classid,pic from article_info where flag = 0 and Audit = 0 order by "& field &" desc,title"
end if
Set Rst = Conn.execute(SqlT)
if Rst.eof and Rst.bof then
Response.write "还没有添加文章。"
else
do while not Rst.eof
Response.Write(bullet)
Response.Write "<a href=list.asp?unid=" & Rst(0) &" target='"& AddOpenWin &"' title="& Qcdn.ReplaceP(Rst(1)) &">" & HTMLcode(GetString(Rst(1),38)) & "</a><br>"
Rst.movenext
loop
end if
Rst.close
end Sub%>
...全文
201 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
wl0618 2006-08-14
  • 打赏
  • 举报
回复
谢谢二位!我试试看
jiangsh100 2006-08-14
  • 打赏
  • 举报
回复
if Rst.eof and Rst.bof then
Response.write "还没有添加文章。"
else
i=1
do while not Rst.eof
Response.Write(bullet)
Response.Write "<a href=list.asp?unid=" & Rst(0) &" target='"& AddOpenWin &"' title="& Qcdn.ReplaceP(Rst(1)) &""
if i<=3 then
response.write "style='color:red'"
end if
response.write ">" & HTMLcode(GetString(Rst(1),38)) & "</a><br>"
i=i+1
Rst.movenext
loop
end if
langya001 2006-08-14
  • 打赏
  • 举报
回复
do while not Rst.eof
Response.Write(bullet)
Response.Write "<a href=list.asp?unid=" & Rst(0) &" target='"& AddOpenWin &"' title="& Qcdn.ReplaceP(Rst(1)) &">" & HTMLcode(GetString(Rst(1),38)) & "</a><br>"
Rst.movenext
---------------------------------------------------
i=0
do while not Rst.eof
Response.Write(bullet)
if i>2 Then
Response.Write "<a href=list.asp?unid=" & Rst(0) &" target='"& AddOpenWin &"' title="& Qcdn.ReplaceP(Rst(1)) &">" & HTMLcode(GetString(Rst(1),38)) & "</a><br>"
Else
Response.Write "<div class="STYLE1" colour="red"><a href=list.asp?unid=" & Rst(0) &" target='"& AddOpenWin &"' title="& Qcdn.ReplaceP(Rst(1)) &">" & HTMLcode(GetString(Rst(1),38)) & "</a></div>"
Rst.movenext
i=i+1
--------------------------------------------------
在CSS里加上.STYLE1 {color: #FF0000}

这样应该可以

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧