onclick鼠标单击改变tr背景色

2025-04-17 09:48:58
推荐回答(3个)
回答1:

window.onload=function showtable(){
var t1 = document.getElementById('t1');
var tr = t1.getElementsByTagName('tr');
for (var i=0;i tr[i].style.backgroundColor="#DFFCFD";
tr[i].onclick=function(){
this.style.backgroundColor="#FFB584";
} }
}

回答2:

.getElementById 改成 .getElementByName试试

回答3:




无标题文档

lalalala