表格背景显示问题?

boys 2003-04-04 11:28:37
一个表格来源于一个数据库
怎样让我的表格行的背景交替显示?(一行蓝,一行黄)
...全文
30 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jobine 2003-04-04
  • 打赏
  • 举报
回复
response.Write "<table>"
sColor=0
while not rs.eof
if sColor=0 then
response.write "<tr><td bgcolor='blue'>"&rs(1)&"</td></tr>"
sColor=1
else
response.write "<tr><td bgcolor='yellow'>"&rs(1)&"</td></tr>"
sColor=0
end if
rs.movenext
wend
response.Write "</table>"
Jaron 2003-04-04
  • 打赏
  • 举报
回复
Do While Not rs.EOF
if count mod 2 = 0 then COLOR="#FFFFFF" else COLOR="#F5F5F5"
response.write "<tr bgcolor=" & COLOR &">
count = count +1
rs.movenext
loop
hkle 2003-04-04
  • 打赏
  • 举报
回复
来晚了!
mypearl 2003-04-04
  • 打赏
  • 举报
回复
<%
set rs = server.createobject("adodb.recordset")
getwen="select wenclass,wenname,wenwriter,wenurl from wen order by wenID asc"
rs.open getwen,conn,1,1
for i=1 to 20 and not rs.eof
if i mod 2=1 then
wenstyle="ad2"
else
wenstyle="ad4"
end if
<tr class=<%=wenstyle%>>
<td width="9%"><%=wenclass%></td>
<td width="75%"><a href="<%=rs(3)%>"><%=rs(1)%></a></td>
<td width="16%"><%=rs(2)%></td>
</tr>
<%
rs.movenext
next
rs.close
set rs=nothing%>
</table>
我这是在CSS里定义了表格,你可以直接改成bgcolor
standy 2003-04-04
  • 打赏
  • 举报
回复
<% colorflag=1
While not rs.eof
IF colorflag=1 THEN
colorflag=0
colorstr="#e7e7e7"
else
colorflag=1
colorstr="#ffffff"
end if%>
<tr>
<td bgcolor="<%=colorstr%>"><%=rs("id")%></td>
<td bgcolor="<%=colorstr%>"><%=rs("statusnm")&"完成"%></td>
</tr>
<%
rs.MoveNext
wend%>
Estyle 2003-04-04
  • 打赏
  • 举报
回复
输出HTML的时候,嵌套一个循环嘛。

28,390

社区成员

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

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