js setattribute批量设置css样式
摘要:firefox等可以使用vardom=document.getElementById("name");dom.setAttribute("s...
firefox等可以使用
var dom=document.getElementById("name");
dom.setAttribute("style","width:10px;height:10px;border:solid 1px red;") ;
IE中则必须使用style.cssText
var dom=document.getElementById("name");
dom1.style.cssText = "width:10px;height:10px;border:solid 1px red;";
补充一下,目前style.cssText类似innerHTML了,已经成为一个web开发的事实标准。因此测试显示firefox浏览器也支持这种方式。
【js setattribute批量设置css样式】相关文章:
★ JavaScript中用sort()方法对数组元素进行排序的操作
★ 对联广告 可关闭
★ 用Node.js通过sitemap.xml批量抓取美女图片
上一篇:
Javascript 二维数组
下一篇:
Javascript 复制数组实现代码