jquery学习笔记(二)
2010-07-16 10:58
190 查看
制作双色Table,鼠标经过时颜色发生改变的jquery实现方法
...
<!--table样式-->
<style type="text/css">
th{
background:#e43d5f;
color:blue;
}
td{
font-size:13pt;
text-align:center;
}
tr.over td{
background:#8f432d; //鼠标经过时颜色发生变化
}
tr.alternate td{
background:#9f8858; //表格行间隔显示颜色
}
</style>
<!--引用jquery-->
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".strip tr").mouseover(function()
{$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over"); //鼠标经过和鼠标移出时
}
);
$(".strip tr:even").addClass("alternate"); //偶数行颜色发生改变
});
</script>
...
<table class="strip">
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
</thead>
<tr>
<td>张三</td>
<td>20</td>
</tr>
<tr>
<td>李四</td>
<td>21</td>
</tr>
<tr>
<td>王五</td>
<td>22</td>
</tr>
<tr>
<td>余六</td>
<td>23</td>
</tr>
<tbody>
</tbody>
</table>
...
<!--table样式-->
<style type="text/css">
th{
background:#e43d5f;
color:blue;
}
td{
font-size:13pt;
text-align:center;
}
tr.over td{
background:#8f432d; //鼠标经过时颜色发生变化
}
tr.alternate td{
background:#9f8858; //表格行间隔显示颜色
}
</style>
<!--引用jquery-->
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".strip tr").mouseover(function()
{$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over"); //鼠标经过和鼠标移出时
}
);
$(".strip tr:even").addClass("alternate"); //偶数行颜色发生改变
});
</script>
...
<table class="strip">
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
</tr>
</thead>
<tr>
<td>张三</td>
<td>20</td>
</tr>
<tr>
<td>李四</td>
<td>21</td>
</tr>
<tr>
<td>王五</td>
<td>22</td>
</tr>
<tr>
<td>余六</td>
<td>23</td>
</tr>
<tbody>
</tbody>
</table>
相关文章推荐
- jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要)
- JQuery学习笔记
- JQuery学习笔记
- jQuery学习笔记(4)--Jquery中获取table中某列值的具体思路
- jQuery 学习笔记 一 初体验
- Java程序员的JavaScript学习笔记(10—— jQuery-在“类”层面扩展)
- jquery学习笔记----隐藏、显示、切换,滑动,淡入淡出,以及动画
- jquery学习笔记之选择器
- jQuery学习笔记之九------事件对象
- JQuery简介及语法学习笔记
- jQuery学习笔记——流水账part1
- jQuery学习笔记之十------高级事件
- 总结jQuery学习笔记-带你由浅入深学习jQuery(3)
- 【学习笔记】锋利的jQuery(四)AJAX
- jQuery学习笔记(一)
- 【jQuery UI 1.8 The User Interface Library for jQuery】.学习笔记.1.CSS框架和其他功能
- 菜鸟的jQuery源码学习笔记(一)
- JQUERY1.9学习笔记 之基本过滤器(十一) 奇数选择器
- jQuery学习笔记之选取选定复选框的同行某列元素
- JQuery学习笔记之change事件