/**
使 IFRAME 自动适应大小
*/
function mm_iframeAutoFit()
{
try
{
if(window!=parent && location.href.split("bearbear").length<=1)
{
var a = parent.document.getElementsByTagName("IFRAME");
for(var i=0; i<a.length; i++) //author:meizz
{
if(a[i].contentWindow==window)
{
var h = document.body.scrollHeight;
//if(document.all) {h += 4;}
if(window.opera) {h += 1;}
a[i].style.height = h;
mm_iframeAutoFitParent(parent);
}
}
}
}
catch (ex)
{
alert("脚本无法跨域操作!");
}
}
/**
使 IFRAME 自动适应大小,将会递归的调用
*/
function mm_iframeAutoFitParent(window)
{
try
{
if(window!=window.parent && window.name != 'mainFrame')
{
var a = window.parent.document.getElementsByTagName("IFRAME");
for(var i=0; i<a.length ; i++) //author:meizz
{
if(a[i].contentWindow==window)
{
var h = window.document.body.scrollHeight;
if(window.opera) {h += 1;}
a[i].style.height = h;
mm_iframeAutoFitParent(window.parent);
}
}
}
}
catch (ex)
{
alert("脚本无法跨域操作!");
alert(ex);
}
}
IFRAME自动适应大小
最新推荐文章于 2023-04-01 13:38:02 发布