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
)

posted @ 2011-07-22 01:30  Arliang  阅读(926)  评论(0编辑  收藏  举报