js读取CSS样式表样式

js中obj.style.height不能直接取css样式和嵌入的样式(style标签包起来的),

需要用

getComputedStyle 

但IE又不支持,只能这样做:

function getstyle(obj) {
return window.getComputedStyle ? window.getComputedStyle(obj, null).height : obj.currentStyle.height;
}

posted @ 2015-02-04 12:00  h-bings  阅读(264)  评论(0)    收藏  举报