但是事情還沒完,萬惡的IE不支持此方法,它有自己的一個實現(xiàn)方式,那就是currentStyle,不同于全局方法getComputedStyle,它是作為DOM元素屬性存在的,如:obj.currentStyle.paddingLeft,在IE中就獲取到對象的左內邊距了,兼容性的寫法如下: 復制代碼代碼如下: return window.getComputedStyle ? window.getComputedStyle(obj,...
www.dbjr.com.cn/article/348...htm 2025-6-6