参考:https://blog.csdn.net/qq_23614619/article/details/81075793
js获取class中属性需要的函数obj.currentStyle[attr]和getComputedStyle(element, null)
var oDiv = document.getElementById('div1');
function getStyle(obj, attr){
return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj, false)[attr];
}
getStyle(oDiv, 'width')