js模块代码
function getStyle(obj,attr){
if(obj.currentStyle){//兼容ie
return obj.currentStyle[attr];
}
else{
return getComputedStyle(obj,null)[attr];
}
}
window.onload=function(){
oDiv= document.getElementsById('div');
console.log((oDiv,'width'));
}
HTML
<div id='div'>fasdfsdfsdfsd</div>
style
#div{100px;height:100px;border:#FF0000 solid 1px;}