2011-04-12 205 views

回答

1

试试这个代码来切换颜色

onClick="this.style.backgroundColor=='black' ? this.style.backgroundColor='white' : this.style.backgroundColor='black';" 

,你会得到使用此功能

var tds = document.getElementsByTagName("td"); 
for(var i=0; i<tds.length; i++) 
{ 
alert(tds[i].style.backgroundColor); 
} 
} 
+0

感谢很多的颜色,以及如何更改后得到的细胞颜色? – DmitryB 2011-04-12 03:38:25

+0

我修改了答案 – Anuraj 2011-04-12 03:43:45

+0

谢谢,Anuraj – DmitryB 2011-04-12 03:47:11

相关问题