>  기사  >  웹 프론트엔드  >  其他内核应该如何表示parent.document.getElementById.style.height呢?_html/css_WEB-ITnose

其他内核应该如何表示parent.document.getElementById.style.height呢?_html/css_WEB-ITnose

WBOY
WBOY원래의
2016-06-24 12:07:071390검색

我在IE中,直接用alert(parent.document.getElementById('aa').style.height)是可以显示其高度的,但用webkit内核的浏览器却不行,webkit究竟是如何表示以上的内容呢?那么chrome又如何表示呢?谢谢各位!


回复讨论(解决方案)

var value = element.style[style];    if (!value || value === 'auto') {      var css = document.defaultView.getComputedStyle(element, null);      value = css ? css[style] : null;    }


css = document.defaultView.getComputedStyle(element, null);
var mheight = css['height'];

var value = element.style[style];    if (!value || value === 'auto') {      var css = document.defaultView.getComputedStyle(element, null);      value = css ? css[style] : null;    }


css = document.defaultView.getComputedStyle(element, null);
var mheight = css['height'];

这段是否所有内核都支持啊?

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.