获取非行间样式 #div1{height: 200px;width: 200px;background-color: red;} function getStyle(obj,name){ if(obj.currentStyle){ return obj.currentStyle[name]; //IE浏览器 } else if(getComputedStyle){ //Firefox,chrome浏览器 return getComputedStyle(obj,null)[name]; } } window.onload = function(){ var oDiv = document.getElementById('div1'); alert(getStyle(oDiv,'height')); }
查看更多关于JS获取非行间样式及兼容问题_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did111956