HTML DOM Style对象
----- Style对象代表一个单独的样式声明。可从应用样式的文档或元素访问Style对象。
1、使用Style对象属性:
document.getElementById("test").style.property = "对应的值";
document.getElementById("test").style[property] = "对应的值";
2、cssText属性
----它是一组样式属性及其值的文本表示。
举例说明:
<input type="text" id="test" style="width:220px;height:20px;"/>
document.getElementById('test').style.cssText; //"width: 220px; height: 20px;"
扩展阅读:
1、http://www.w3school.com.cn/htmldom/dom_obj_style.asp
本文深入探讨了HTMLDOMStyle对象的使用方法,包括如何通过属性和cssText属性访问和修改样式。提供了实例演示,并扩展了相关阅读资源。
1031

被折叠的 条评论
为什么被折叠?



