getStyle函数

window.getStyle = (document.body.currentStyle	//这样做是为了让函数有“记性”,不用每次使用这函数的时候都判断一次
	? function (obj, attribute){
		obj.currentStyle[attribute]
	} : document.defaultView
	? function (obj, attribute){
		return document.defaultView.getComputedStyle(obj,false)[attribute];
	} : function (){
		return null;
	}//IE下body的width为auto,要换clientWidth
)

原文地址:https://www.cnblogs.com/arliang/p/2113436.html