主页调用iFrame如下:
<iframe src="Index.aspx" align=middle id="mainFrame" onload='this.height=document.frames["mainFrame"].document.body.scrollHeight' hspace="0" vspace="0"
WIDTH='100%' marginwidth=0 MARGINHEIGHT=0 FRAMEBORDER='0' SCROLLING='no' ></iframe>
WIDTH='100%' marginwidth=0 MARGINHEIGHT=0 FRAMEBORDER='0' SCROLLING='no' ></iframe>
iFrame页(子页)调用JS函数,可调整主页调用的iFrame的高度
<SCRIPT LANGUAGE="JavaScript">
function frameStyleResize()
{
var HeightValue = document.body.scrollHeight;
if(HeightValue < 700)
{
HeightValue = 700;
}
parent.document.getElementById("mainFrame").style.height = HeightValue;
}
</SCRIPT>
<body onload="frameStyleResize();">
function frameStyleResize()
{
var HeightValue = document.body.scrollHeight;
if(HeightValue < 700)
{
HeightValue = 700;
}
parent.document.getElementById("mainFrame").style.height = HeightValue;
}
</SCRIPT>
<body onload="frameStyleResize();">