读书人

怎么在用setAttribute设置style里的属

发布时间: 2012-01-02 22:40:04 作者: rapoo

如何在用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 ";

读书人网 >asp.net

热点推荐