JS实现表格间隔颜色。鼠标滑动高亮显示

2016-01-13 0 1,007
JS实现表格间隔颜色。鼠标滑动高亮显示
$(function(){
	$(".high_light tr").mouseover(function() {  
			$(this).addClass("over");  
		}).mouseout(function() {  
			$(this).removeClass("over");  
		});  
})
<style> tr.over td {background:#D9EDF7;}</style>

下面是复制过来的别人的

<script type="text/javascript" >  
$(document).ready(function() {  
            $(".stripe tr").mouseover(function() {  
  
                        $(this).addClass("over");  
                    }).mouseout(function() {  
                        $(this).removeClass("over");  
                    });  
            $(".stripe tr:even").addClass("alt");  
        }  
  
)  
  
</script>  
  
<style type="text/css">  
/*注意选择器的层叠关系*/  
th {  
        background:#0066FF;  
        color:#FFFFFF;  
        line-height:20px;  
        height:30px;  
}  
   
td {  
        padding:6px 11px;  
        border-bottom:1px solid #95bce2;  
        vertical-align:top;  
        text-align:center;  
}  
   
td * {  
        padding:6px 11px;  
}  
   
tr.alt td {  
        background:#ecf6fc;  /*这行将给所有的tr加上背景色*/  
}  
   
tr.over td {  
        background:#bcd4ec;  /*这个将是鼠标高亮行的背景色*/  
}  
</style>

来自:http://my.oschina.net/u/2411815/blog/599760

遇见资源网 js/jquery JS实现表格间隔颜色。鼠标滑动高亮显示 http://www.ox520.com/11321.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务