当前位置: 代码迷 >> ASP.NET >> 怎么在用setAttribute设置style里的属性值呢
  详细解决方案

怎么在用setAttribute设置style里的属性值呢

热度:9951   发布时间:2013-02-26 00:00:00.0
如何在用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 ";
  相关解决方案