分享

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

 阅读360度 2016-01-13
$(function(){
    $(".high_light tr").mouseover(function() {  
            $(this).addClass("over");  
        }).mouseout(function() {  
            $(this).removeClass("over");  
        });  
})
1
<style> tr.over td {background:#D9EDF7;}</style>

下面是复制过来的别人的

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<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>


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多