| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 880 人关注过本帖
标题:ASP分列显示并且隔行换背景色问题!
只看楼主 加入收藏
qcxy
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-8-15
收藏
 问题点数:0 回复次数:5 
ASP分列显示并且隔行换背景色问题!
我想实现一行分两列,并且想要隔行换一种背景颜色,可是在换背景颜色的时候老是不对,请高手帮忙看一下,指点一下!
效果如下:
代码如下:
<table>
<%
Sql="select * from Ent_info order by id desc"
Set Rs=Conn.ExeCute(Sql)
if not Rs.eof then
i=0
do while not Rs.eof
bt_str=trim(Rs("Ent_name"))
if i mod 2=0 then
color_sign="#ECF5FF"
else
color_sign=""
end if
if i=2 then
i=0
%>
<tr bgcolor="<%=color_sign%>">
<%end if%>
<td width="4%" height=20 class=a12><img src="image/mz_icontop.gif" width="25" height="15"></td>
<td width="45%" align=middle class=a12><p align="left"><%=bt_str%></p></td>
<%
Rs.movenext
i=i+1
Loop
end if
Rs.close
'--------------企业名录列表结束 -----------------
%>
</tr>
</table>

[[it] 本帖最后由 qcxy 于 2008-8-16 09:04 编辑 [/it]]
搜索更多相关主题的帖子: ASP 隔行 分列 
2008-08-15 22:55
kira007
Rank: 2
等 级:论坛游民
帖 子:294
专家分:27
注 册:2007-6-28
收藏
得分:0 
<table>
<tr >
<% dim color_sign
Sql="select * from Ent_info order by id desc"
Set Rs=Conn.ExeCute(Sql)
i=0
color_sign="#ffffff"
do while not Rs.eof
%>
<td width="4%" height=20 class=a12><img src="image/mz_icontop.gif" width="25" height="15"></td>
<td width="45%" align=middle class=a12><p align="left"><%=Rs("Ent_name")%></p></td>
<%
i=i+1
if i mod 2=0 then
color_sign="#ECF5FF"
response.write"</tr><tr bgcolor="&color_sign&">"
end if
Rs.movenext
Loop
end if
Rs.close
'--------------企业名录列表结束 -----------------
%>
</tr>
</table>

生活的理想,就是为了理想的生活。
2008-08-16 00:02
qcxy
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-8-15
收藏
得分:0 
楼上的,很感谢你给我回贴
楼上的,很感谢你给我回贴,可是效果不是我想要的,颜色隔行显示还是不行啊!
2008-08-16 00:14
xiaojie_cp
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2006-6-9
收藏
得分:0 
<table>
<%
Sql="select * from Ent_info order by id desc"
Set Rs=Conn.ExeCute(Sql)
if not Rs.eof then
i=0
do while not Rs.eof
bt_str=trim(Rs("Ent_name"))
if i mod 2=0 then
color_sign="#ECF5FF"
else
color_sign=""
end if
%>
<tr>
<td bgcolor="<%=color_sign%>" width="4%" height=20 class=a12><img src="image/mz_icontop.gif" width="25" height="15"></td>
<td bgcolor="<%=color_sign%>" width="45%" align=middle class=a12><p align="left"><%=bt_str%></p></td>
%>
</tr>
<%
Rs.movenext
i=i+1
Loop
end if
Rs.close
'--------------企业名录列表结束 -----------------
%>

</table>
或者

<table>
<%
color_sign=""
Sql="select * from Ent_info order by id desc"
Set Rs=Conn.ExeCute(Sql)
if not Rs.eof then
do while not Rs.eof
    bt_str=trim(Rs("Ent_name"))
    if color_sign="" then
        color_sign="#ECF5FF"
    else
        color_sign=""
    end if
    %>
    <tr>
    <td  bgcolor="<%=color_sign%>" width="4%" height=20 class=a12><img src="image/mz_icontop.gif" width="25" height="15"></td>
    <td bgcolor="<%=color_sign%>" width="45%" align=middle class=a12><p align="left"><%=bt_str%></p></td>
    <%
    Rs.movenext
    %>
    </tr>
    <%
Loop
end if
Rs.close
'--------------企业名录列表结束 -----------------
%>
</table>
2008-08-16 02:01
qcxy
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-8-15
收藏
得分:0 
都不对呀!
我想要一行显示两条信息,可都是一条,隔行显示倒是可以!!
2008-08-16 08:49
tianyu123
Rank: 1
等 级:新手上路
威 望:2
帖 子:576
专家分:0
注 册:2007-8-26
收藏
得分:0 
做个参考吧
程序代码:
<%
dim i
response.write"<table border=0 cellspacing=1 cellpadding=0 bgcolor='#ECECEC'><tr bgcolor='#FFFFFF'>"
for i=1 to 13
    response.write"<td width=80 height=30 align=center>"& i &"</td>"
    if i mod 2=0 then
       if i mod 4=0 then 
          response.write"</tr><tr bgcolor='#FFFFFF'>"
       else
          response.write"</tr><tr bgcolor='#ECECEC'>"
       end if
    end if
next
if i mod 2=0 then
   response.write"<td>&nbsp;</td>"
end if
response.write"</tr></table>"
%>

改变一切,须从改变观念开始!
2008-08-16 12:02
快速回复:ASP分列显示并且隔行换背景色问题!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019681 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved