改變顏色 這里哪里有錯
window.onload = function(){? ? ? ? ? ? ?
? ? ?// 鼠標(biāo)移動改變背景,可以通過給每行綁定鼠標(biāo)移上事件和鼠標(biāo)移除事件來改變所在行背景色。
? ? ? ? ?var tr=document.getElementsByTagName('tr');? ? ? ? ?
? ? ? ? ?for(var i=0;i<tr.length;i++)
? ? ? ? ?{
? ? ? ? tr[i].onmouseover=function (){
? ? tr[i].style.background='#f2f2f2';}
? ??
? ? tr[i].onmouseout=function (){
? ? ? ? tr[i].style.background='#fff';}?
? ? ? ? ?}
? ? ? }
2019-02-01
tr[i].style.background='#f2f2f2';? 這個應(yīng)該是tr[i].style.backgroundColor='#f2f2f2';吧