js选中行高亮

.t1
{
  clear: both;
  border: 1px solid #c9dae4;
}
.t1 tr th
{
  color: #0d487b;
  background: #f2f4f8 url(../CSS/Table/images/sj_title_pp.jpg) repeat-x left bottom;
  line-height: 28px;
  border-bottom: 1px solid #9cb6cf;
  border-top: 1px solid #e9edf3;
  font-weight: normal;
  text-shadow: #e6ecf3 1px 1px 0px;
  padding-left: 5px;
  padding-right: 5px;
}
.t1 tr td
{
  border-bottom: 1px solid #e9e9e9;
  padding-bottom: 5px;
  padding-top: 5px;
  color: #444;
  border-right: 1px solid #e9e9e9;
  border-left: 1px solid #e9e9e9;
  border-top: 1px solid #FFFFFF;
  padding-left: 5px;
  padding-right: 5px;
  word-break: break-all;
}
/* white-space:nowrap; text-overflow:ellipsis; */
tr.alt td
{
  background: #ecf6fc; /*这行将给所有的tr加上背景色*/
}
tr.over td
{
  background: #bcd4ec; /*这个将是鼠标高亮行的背景色*/
}

以上为style部分

<script type="text/javascript">
        $(document).ready(function () { //这个就是传说的ready  
          $(".t1 tr").mouseover(function () {
                //如果鼠标移到class为stripe的表格的tr上时,执行函数  
                $(this).addClass("over");
              }).mouseout(function () {
                //给这行添加class值为over,并且当鼠标一出该行时执行函数  
                $(this).removeClass("over");
            }) //移除该行的class  
              $(".t1 tr:even").addClass("alt");
            //给class为stripe的表格的偶数行添加class值为alt
          });
        </script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值