iframe 不能正常显示
在一个aspx页面上有一个Iframe。
该Iframe用以下代码实现自适应高度
<iframe src="test.asp" width="100%" frameborder="0" scrolling="no" name="hj" id="hj"></iframe>
test.asp页面head间增加如下JS代码
<SCRIPT LANGUAGE="JavaScript">
function f_frameStyleResize(targObj){
var targWin = targObj.parent.document.all[targObj.name];
if(targWin != null) {
var HeightValue = targObj.document.body.scrollHeight
if(HeightValue < 600){HeightValue = 600}
targWin.style.pixelHeight = HeightValue;
}
}
function f_iframeResize(){
bLoadComplete = true; f_frameStyleResize(self);
}
var bLoadComplete = false;
window.onload = f_iframeResize;
</SCRIPT>
现在自适应高度能做出来,可是这个Iframe却不能在打开页面时正常显示,往往是刷新七八次后才能在页面上显示出来。
请告诉我如何解决?
谢谢!!!