CSS中的隔行换色
来源:互联网 发布:淘宝裂变软件多少钱 编辑:程序博客网 时间:2024/06/07 05:35
一.表格的<tr>隔行换色
<style type="text/css">
<!--
tr {background-color:expression((this.sectionRowIndex==0)?"":
(this.sectionRowIndex%2==0)?"red":"blue")}
-->
</style>
</HEAD>
<table>
<tr>
<td>第1行</td><td>第1行</td>
</tr>
<tr>
<td>第2行</td><td>第2行</td>
</tr>
<tr>
<td>第3行</td><td>第3行</td>
</tr>
<tr>
<td>第4行</td><td>第4行</td>
</tr>
<tr>
<td>第5行</td><td>第5行</td>
</tr>
</table>
二.表格的td换色
<style type="text/css">
<!--
tr {background-color:expression((this.sectionRowIndex%2==0)?"red":"blue")}
td {background-color:expression((this.cellIndex%2==0)?"":((this.parentElement.sectionRowIndex%2==0)?"green":"yellow"))}
-->
</style>
</HEAD>
<table>
< tr><td>第1行</td><td>第1行</td><td>第1行< /td><td>第1行</td><td>第1行</td></tr>
< tr><td>第2行</td><td>第2行</td><td>第2行< /td><td>第2行</td><td>第2行</td></tr>
< tr><td>第3行</td><td>第3行</td><td>第3行< /td><td>第3行</td><td>第3行</td></tr>
< tr><td>第4行</td><td>第4行</td><td>第4行< /td><td>第4行</td><td>第4行</td></tr>
< tr><td>第5行</td><td>第5行</td><td>第5行< /td><td>第5行</td><td>第5行</td></tr>
</table>
三.Li标签隔行换色代码
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.t1 {background-color:#336699;text-align:center}
.t2 {background-color:#ffcc00;text-align:center}
ul{list-style:none;width:200px;}
ul li{height:20px;line-height:20px;width:200px;}
</style>
<script>
<!-- POPOEVER is drinking half bottle of lemon tea:) --
function ulLi() {
for (i=1;i<bkg1.children.length+1;i++) {
(i%2>0)?(bkg1.children(i-1).className = "t1"):(bkg1.children(i-1).className = "t2");
}
}
//-- Lemon tea is bottom up -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="ulLi();">
<ul id="bkg1">
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
</ul>
</body>
</html>
出自: http://www.blogjava.net/liuwentao253/archive/2007/08/07/134903.html
<style type="text/css">
<!--
tr {background-color:expression((this.sectionRowIndex==0)?"":
(this.sectionRowIndex%2==0)?"red":"blue")}
-->
</style>
</HEAD>
<table>
<tr>
<td>第1行</td><td>第1行</td>
</tr>
<tr>
<td>第2行</td><td>第2行</td>
</tr>
<tr>
<td>第3行</td><td>第3行</td>
</tr>
<tr>
<td>第4行</td><td>第4行</td>
</tr>
<tr>
<td>第5行</td><td>第5行</td>
</tr>
</table>
二.表格的td换色
<style type="text/css">
<!--
tr {background-color:expression((this.sectionRowIndex%2==0)?"red":"blue")}
td {background-color:expression((this.cellIndex%2==0)?"":((this.parentElement.sectionRowIndex%2==0)?"green":"yellow"))}
-->
</style>
</HEAD>
<table>
< tr><td>第1行</td><td>第1行</td><td>第1行< /td><td>第1行</td><td>第1行</td></tr>
< tr><td>第2行</td><td>第2行</td><td>第2行< /td><td>第2行</td><td>第2行</td></tr>
< tr><td>第3行</td><td>第3行</td><td>第3行< /td><td>第3行</td><td>第3行</td></tr>
< tr><td>第4行</td><td>第4行</td><td>第4行< /td><td>第4行</td><td>第4行</td></tr>
< tr><td>第5行</td><td>第5行</td><td>第5行< /td><td>第5行</td><td>第5行</td></tr>
</table>
三.Li标签隔行换色代码
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
.t1 {background-color:#336699;text-align:center}
.t2 {background-color:#ffcc00;text-align:center}
ul{list-style:none;width:200px;}
ul li{height:20px;line-height:20px;width:200px;}
</style>
<script>
<!-- POPOEVER is drinking half bottle of lemon tea:) --
function ulLi() {
for (i=1;i<bkg1.children.length+1;i++) {
(i%2>0)?(bkg1.children(i-1).className = "t1"):(bkg1.children(i-1).className = "t2");
}
}
//-- Lemon tea is bottom up -->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="ulLi();">
<ul id="bkg1">
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
<li>li背景变变变</li>
</ul>
</body>
</html>
出自: http://www.blogjava.net/liuwentao253/archive/2007/08/07/134903.html
- CSS中的隔行换色
- css隔行换色
- CSS隔行换色
- CSS隔行换色
- css 表格隔行换色
- CSS之隔行换色
- table隔行换色 css
- 表格隔行换色(CSS版)
- CSS控制表格Table隔行换色
- css隔行换色的方法
- CSS设置表格隔行换色
- 纯CSS隔行换色效果
- 四种实现CSS隔行换色的方法
- css隔行换色和鼠标划过变色
- CSS之Table表格隔行换色之简洁版
- css和js处理隔行换色的问题
- 表格隔行换色
- 表格隔行换色
- firefox下如何改变onunload
- JS 中调用 JS-原创天地
- 文韬:3个方法吸引搜索引擎快速收录新站
- spring mvc的Controller ( 不断补充)
- 如何利用SEO推介火狐狸浏览器
- CSS中的隔行换色
- 菜鸟站长的seo方法
- [转贴]P2P协议的变迁
- 程序取百度的新闻
- WAP网关服务器应用形式
- SEO高手 就是内容优化的高手
- Java(1)
- Action的困惑与消息传递
- PHP中调用Java类的两种方法