我们有时获取 styl.width为空的时候,可以获取css中的width..
但ie and ff 是不同的。。
ie:
obj.currentStyle['width']
ff:
var css = document.defaultView.getComputedStyle(obj, null);
css.getPropertyValue('width')
本文介绍了一种在不同浏览器中获取元素宽度的方法。针对IE和Firefox等浏览器的不同特性,提供了具体的实现方式,包括使用currentStyle属性和getComputedStyle方法。
我们有时获取 styl.width为空的时候,可以获取css中的width..
但ie and ff 是不同的。。
ie:
obj.currentStyle['width']
ff:
var css = document.defaultView.getComputedStyle(obj, null);
css.getPropertyValue('width')
536
1097
4901

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