2011-04-12 208 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

相關問題