以前获取,或改变某个表单的样式,一般通过将该表单的style写入到表单,然后通过obj.style.属性 = 改变值.
如果该表单样式写在外部样式表里中,用上面的方法则要报错。这里介绍一个好的方法。document.styleSheets[0].
例如:
var objstyle = document.styleSheets[0].rules;
if(obj.currentStyle) //ie
{
var ierules = objstyle.rules[0];
ierules.style.属性 = 改变值;
}
else if(window.getComputedStyle)
{
var ffrules = objstyle.cssRules[0];
ffrules.style.属性 = 改变值;
}
本文介绍如何在外部样式表中修改表单样式,并针对不同浏览器提供了兼容性解决方案。
814

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



