Jquery表格双色显示,鼠标滑过样式
<script type="text/javascript" src="${ctx}/js/jquery-1.4.4.min.js"></script>//id为table1 tr 奇偶行色$("#table1 tr:even").not("tr:first").css({ color: "black", background: "#e5f1f4" });$("#table1 tr:odd").css({ color: "black", background: "#f8fbfc" });//tr 设置第一行色css$("#table1 tr").first().css({color: "white", background: "#328aa4"});//如果鼠标移到tr上时,执行函数$("#table1 tr").mouseover(function(){$(this).css({color: "white", background: "#328aa4"});}).mouseout(function(){//给这行添加class值,鼠标移出该行时执行函数$("#table1 tr:even").not("tr:first").css({ color: "black", background: "#e5f1f4" });$("#table1 tr:odd").css({ color: "black", background: "#f8fbfc" });$("#table1 tr").first().css({color: "white", background: "#328aa4"});})
页:
[1]