手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jQuery表格行换色的三种实现方法
jQuery表格行换色的三种实现方法
摘要:复制代码代码如下:$('tr').hover(function(event){$(this)[(event.type=='mouseente...

复制代码 代码如下:

$('tr').hover(function(event) {

$(this)[ (event.type == 'mouseenter' ? 'add' : 'remove') + 'Class' ]('test'); //test是样式

});

$('tr').hover(function(event) {

$(this).toggleClass('test'); //test是样式

});

$('tr').hover(function(){

$(this).addClass('test'); //test是样式

},function(){

$(this).removeClass('test'); //test是样式

});

注:一般情况下使用第二种方法是可以的,但是遇到表格行可以拖拽的情况,那么就会出现BUG了,这个自行测试就知道了。

【jQuery表格行换色的三种实现方法】相关文章:

jQuery获得字体颜色16位码的方法

js实现鼠标经过表格行变色的方法

javascript无刷新评论实现方法

jQuery实现转动随机数抽奖效果的方法

javascript实现table表格隔行变色的方法

jquery实现图片左右切换的方法

jQuery获取字符串中出现最多的数

jQuery实现延迟跳转的方法

jquery预加载图片的方法

JS或jQuery获取ASP.NET服务器控件ID的方法

精品推荐
分类导航