首頁  >  文章  >  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