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>
本文由用戶 admin 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!