jQuery实现表格颜色交替显示的方法
本文实例讲述了jQuery实现表格颜色交替显示的方法。分享给大家供大家参考。具体实现方法如下:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery实现表格颜色的交替显示</title>
<scripttype="text/javascript"src="js/jquery1.3.2.js"></script>
<scripttype="text/javascript">
jQuery(document).ready(function(){
jQuery(".truecolortr:odd").addClass("color1");
jQuery(".truecolortr:even").addClass("color2");
jQuery(".truecolortr").hover(function(){
jQuery(this).addClass("color3")
},function(){
jQuery(this).removeClass("color3")
});
});
</script>
<styletype="text/css">
.truecolor{border:1pxsolid#333;text-align:center;}
.truecolorth{background-color:#333;color:#FFF;}
.color1{background-color:#DDD;color:#333;}
.color2{background-color:#EEE;color:#333;}
.color3{background-color:#666;color:#FFF;}
</style>
</head>
<body>
<tablewidth="450"class="truecolor">
<thead>
<tr>
<th>博客</th>
<th>作者</th>
<th>网址</th>
</tr>
</thead>
<tbody>
<tr>
<td>风格之舞</td>
<td>火德</td>
<td>隔行换色</td>
</tr>
<tr>
<td>赵雷的博客</td>
<td>赵雷</td>
<td>新浪微博</td>
</tr>
<tr>
<td>寂寞广场</td>
<td>魏春亮</td>
<td>同学录</td>
</tr>
<tr>
<td>淘宝UED</td>
<td>淘宝</td>
<td>经常购物</td>
</tr>
</tbody>
</table>
</body>
</html>
希望本文所述对大家的jQuery程序设计有所帮助。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下