日期:2014-05-19  浏览次数:20480 次

如何在用setAttribute设置style里的属性值呢
比如
<table   id= "a "   width=768   height=600
style= "background-color:Aqua;   border-style:solid;   ">
<tr> <td> xxx </td> </tr>
</table>

我想用   setAttribute方法把   style   里的属性换成“background-color:blue;”

不知道改怎么办
我试过了先用romoveAttribute   方法   去掉style
然后再用a.setAttribute.(“style”,“background-color:blue;”)方法设置
结果好像没有出现意料中的效果

------解决方案--------------------
js?
document.getElementById( "a ").style.backgroundColor = "blue ";