简单问题:为什么我动态地改变td的背景颜色,总是不行?

1<td bgcolor="#000000" id="CurrentColor" rowspan="2" width="5%"><img height="33" src="images/p_b.gif" width="33"/></td>
1<td onclick="CurrentColor.bgcolor = '#00FFFF';alert('chang color');" width="2%"><img height="16" src="images/c_b.gif" width="16"/></td>

alert对话框都弹出来了,可是id为CurrentColor的TD的颜色还是没有改变,为什么呀?
---------------------------------------------------------------

1<table><tr>
2<td bgcolor="#000000" id="CurrentColor" rowspan="2" width="5%"><img height="33" src="images/p_b.gif" width="33"/></td>
3<td onclick="CurrentColor.style.backgroundColor='#00FFFF';alert('chang color');" width="2%"><img height="16" src="images/c_b.gif" width="16"/></td>
4</tr></table>

CurrentColor.style.backgroundColor='#00FFFF'
---------------------------------------------------------------

又捡个便宜
OnClick="CurrentColor.style.backgroundColor = '#00FFFF'"

给分!

Published At
Categories with Web编程
Tagged with
comments powered by Disqus