jquery实现鼠标悬停单元格变色
来源:互联网 发布:mac右键怎么按 编辑:程序博客网 时间:2024/05/22 00:34
<style>
.hover{ background-color: #ccc;cursor:pointer;}
.selected{background-color:gray;color:#666;cursorf:auto;}
</style>
</head>
<body>
<button id="getData">获取数据</button>
<table>
<tbody>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
</tbody>
</table>
</body>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.4.min.js"></script>
<script type="text/javascript">
$(function(){
$('table tbody tr').bind('mouseover',function(){
$(this).addClass('hover');
});
$('table tbody tr').bind('mouseout',function(){
$(this).removeClass('hover');
});
$('table tbody tr').bind('click',function(){
$(this).removeClass('hover');
$(this).addClass('selected');
$(this).unbind('mouseover');
$(this).removeClass('mouseout');
});
});
</script>
.hover{ background-color: #ccc;cursor:pointer;}
.selected{background-color:gray;color:#666;cursorf:auto;}
</style>
</head>
<body>
<button id="getData">获取数据</button>
<table>
<tbody>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
<tr><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td><td>年龄</td></tr>
</tbody>
</table>
</body>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.10.4.min.js"></script>
<script type="text/javascript">
$(function(){
$('table tbody tr').bind('mouseover',function(){
$(this).addClass('hover');
});
$('table tbody tr').bind('mouseout',function(){
$(this).removeClass('hover');
});
$('table tbody tr').bind('click',function(){
$(this).removeClass('hover');
$(this).addClass('selected');
$(this).unbind('mouseover');
$(this).removeClass('mouseout');
});
});
</script>
0 0
- jquery实现鼠标悬停单元格变色
- jQuery实现HTML表格隔行变色及鼠标悬停变色效果
- jQuery实现HTML表格隔行变色及鼠标悬停变色效果 .
- repeater鼠标悬停变色
- div鼠标悬停变色
- 鼠标悬停,图片变色
- CSS实现鼠标悬停图片时的边框变色效果
- GridView鼠标悬停行变色
- JQuery实现table隔行变色及鼠标滑动变色
- jQuery实现隔行变色、悬停变色 ( CSS3伪类选择器:nth-child() )
- jquery 控制html页面表格当中奇偶行颜色不同 鼠标悬停变色
- GridView显示数据鼠标悬停变色
- 各行换色 鼠标悬停变色
- 去除超级链接的下划线以及在超级链接上实现鼠标悬停变色
- JQUERY实现鼠标悬停在图片上模拟放大镜效果
- 使用jquery实现文字滚动,鼠标悬停效果
- ExtJS4.2 Grid 单元格鼠标悬停提示
- EasyUI Datagrid 鼠标悬停显示单元格内容
- Android中使用Post请求
- 求一个整数的二进制中1的个数
- HYPRE并行库进行稀疏线性方程组求解
- devise 笔记
- 关于Android的一些概念有感
- jquery实现鼠标悬停单元格变色
- 远程jvm调试-备份
- 常见控件的使用方法(一)
- 关于easyui的layout的region的resize的题目(自适应浏览器)
- 大数据与未来社会
- J2SE基础:2.对象的创建与使用
- Eclipse常用开发插件
- Activity的生命周期(一)
- 硬盘如何分区及分区注意事项