In Firefox and IE, enable IFRAME to adapt to highly-adaptive JS functions, as well as Bugs caused by CSS settings on IFRAME pages.
Suitable for javascript with adaptive height of IE and Firefox Code :
View plaincopy to clipboardprint?
Function turnheight (IFRAME)
{
VaR FRM = Document. getelementbyid (IFRAME );
VaR subweb = Document. frames? Document.frames[iframe].doc ument: FRM. contentdocument;
If (FRM! = NULL & subweb! = NULL)
{Frm. Height = subweb. Body. scrollheight + 20 ;}
}
Function turnheight (IFRAME)
{
VaR FRM = Document. getelementbyid (IFRAME );
VaR subweb = Document. frames? Document.frames[iframe].doc ument: FRM. contentdocument;
If (FRM! = NULL & subweb! = NULL)
{Frm. Height = subweb. Body. scrollheight + 20 ;}
}
Call method:
View plaincopy to clipboardprint?
<IFRAME id = iframe1 onload = "turnheight ('iframe1 '); "Height =" 100% "src =" framepage1.html "frameborder = 0 width =" 101% "scrolling = NO> </iframe>
Note: The float attribute and display attribute cannot be used for elements on the IFRAME page. Otherwise, the obtained IFRAME height in Firefox is 0, leading to adaptive height failure.
This article comes from the tornado Information Network http://www.ljf.cn/; original address: http://www.ljf.cn/2010/2/Item231560.html