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
Release: 2016-06-24 12:07:07
Original
1430 people have browsed it

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;    }
Copy after login
Copy after login


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;    }
Copy after login
Copy after login


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

Is this supported by all kernels?

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template