Home >Web Front-end >HTML Tutorial >How should other kernels represent parent.document.getElementById.style.height? _html/css_WEB-ITnose

How should other kernels represent parent.document.getElementById.style.height? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:07:071430browse

In IE, I can directly use alert(parent.document.getElementById('aa').style.height) to display its height, but it cannot be displayed in a browser using webkit kernel. How does webkit express the above? What about the content? So how does chrome represent it? Thank you!


Reply to discussion (solution)

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 '];

Is this supported by all kernels?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn