首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2012-01-02 
如何在用setAttribute设置style里的属性值呢比如tableid a width768height600style background-co

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

热点排行