currentStyle&getComputedStyle获取属性

方法如下:

function getStyle(obj,attr){
    if(obj.currentStyle){
        return obj.currentStyle[attr];  // IE 中的方法
    }else{
        return getComputedStyle(obj,false)[attr];  // 非IE 中的方法
    }
}

如有表述不准确之处,欢迎指正,欢迎补充,感谢阅读!

原文地址:https://www.cnblogs.com/wangzhenyu666/p/8567633.html