aBgColor = ["#FFFFFF","#f2faff","#FFFFCC","#FFFFCC"];
function addTableListener(o,iHead,iEnd)
{
o.style.cursor = "normal";//这行报错,“o is null”
iHead = iHead > o.rows.length?0:iHead;
iEnd = iEnd > o.rows.length?0:iEnd;
for (var i=iHead;i<o.rows.length-iEnd ;i++ )
{
o.rows[i].onmouseover = function(){setTrBgColor(this,true)}
o.rows[i].onmouseout = function(){setTrBgColor(this,false)}
}
}
function setTrBgColor(oTr,b)
{
oTr.rowIndex % 2 != 0 ? oTr.style.backgroundColor = b ? aBgColor[3] : aBgColor[1] : oTr.style.backgroundColor = b ? aBgColor[2] : aBgColor[0];
}
window.onload = function(){addTableListener(document.getElementById("tbColor"),0,0);}
function addTableListener(o,iHead,iEnd)
{
o.style.cursor = "normal";//这行报错,“o is null”
iHead = iHead > o.rows.length?0:iHead;
iEnd = iEnd > o.rows.length?0:iEnd;
for (var i=iHead;i<o.rows.length-iEnd ;i++ )
{
o.rows[i].onmouseover = function(){setTrBgColor(this,true)}
o.rows[i].onmouseout = function(){setTrBgColor(this,false)}
}
}
function setTrBgColor(oTr,b)
{
oTr.rowIndex % 2 != 0 ? oTr.style.backgroundColor = b ? aBgColor[3] : aBgColor[1] : oTr.style.backgroundColor = b ? aBgColor[2] : aBgColor[0];
}
window.onload = function(){addTableListener(document.getElementById("tbColor"),0,0);}
<table border="1" width="800" cellspacing="0" style="border-collapse:collapse" id="tbColor">
<tr style="background-image:url(img/left.jpg)" height="30" class="chaxun_head">
<td width="80"><input name="allcheckbox" type="checkbox" title="全选/取消" onclick="cball(form);">全选/取消</td>