//光棒效果
var _bgColor; //存放原始的 背景颜色
$(document).ready(function()
{
//所有的行鼠标移进时变色
$("tr").hover(function ()
{
_bgColor = $(this)[0].style.backgroundColor;
$(this).css({'background-color' : '#f5f5f5', 'font-weight' : 'bolder'});
},
//移除还原颜色
function () {var cssObj = {'background-color':_bgColor,'font-weight':''}
$(this).css(cssObj);
});
//交替行变色
var trs = $("table").find("tr");
for(i = 0;i<trs.length;i++)
{
var obj = trs[i];
if(i %2 == 0)
obj.style.backgroundColor = "#F5FAFE";
}
});
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/cngine/archive/2009/11/10/4792948.aspx