ホームページ  >  記事  >  php教程  >  iframe 框架自动适应高度

iframe 框架自动适应高度

WBOY
WBOYオリジナル
2016-06-06 20:00:481191ブラウズ

function reinitIframe(){ var iframe = document.getElementById(frame_content); try{ var bHeight = iframe.contentWindow.document.body.scrollHeight; var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; var height = Math.m

function reinitIframe(){
var iframe = document.getElementById("frame_content");
try{
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height =  height;
}
catch (ex){}
}
window.setInterval("reinitIframe()", 200);

 

 

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