/* iframe 框架高度自动修复 只需要在含有框架页的父页中导入此JS引用即可 */
function reInitIframe()
{
var iframes = document.documentElement.getElementsByTagName('iframe');
for(var i=0;i<iframes.length;i++)
{
var iframe = iframes[i];
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){}
}
}
function addReInitIframeEvent()
{
try
{
if( document.documentElement.getElementsByTagName('iframe').length>0 )
{
window.setInterval("reInitIframe()", 200);
}
}catch (ex){}
}
window.attachEvent("onload", addReInitIframeEvent);
function reInitIframe()
{
var iframes = document.documentElement.getElementsByTagName('iframe');
for(var i=0;i<iframes.length;i++)
{
var iframe = iframes[i];
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){}
}
}
function addReInitIframeEvent()
{
try
{
if( document.documentElement.getElementsByTagName('iframe').length>0 )
{
window.setInterval("reInitIframe()", 200);
}
}catch (ex){}
}
window.attachEvent("onload", addReInitIframeEvent);