ホームページ  >  記事  >  ウェブフロントエンド  >  他のカーネルは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 はどのように上記のコンテンツを表現しますか?毛織物?では、クロムはそれをどのように表現するのでしょうか?ありがとう!


ディスカッションへの返信 (解決策)

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 value = element.style[style];    if (!value || value === 'auto') {      var css = document.defaultView.getComputedStyle(element, null);      value = css ? css[style] : null;    }

cs s = document.defaultView .getComputedStyle(element, null);
var mheight = css['height'];
これはすべてのカーネルでサポートされていますか?

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。