Iframe调用高度自适应代码

Iframe调用高度自适应代码(兼容IE、Firefox、chrome、safari)
javascript代码部分:
[cce]
function stateChangeIE(_frame)
{
if (_frame.readyState==”complete”) //state: loading ,interactive, complete
{
AutoHeight();
}
}

function stateChangeFirefox(_frame)
{
AutoHeight();
}

function AutoHeight()
{
if(document.readyState!=’complete’)
{
setTimeout( function(){AutoHeight();},50 );
return;
}
else
{
try
{
var ifobj=document.getElementById(“mainFrame”);
ifobj.style.height = ifobj.contentWindow.document.body.scrollHeight + 0 + “px”;
} //加上0是为了让非IE浏览器中高度不一直增加
catch(e)
{}
}
}
[/cce]
iframe代码部分:
[cce]

[/cce]
不会用!收藏先…