Method 1:
CopyCode The Code is as follows: <SCRIPT type = "text/JavaScript" Language = "JavaScript">
<! --
// Adjust the height of pagecontent
Function tuneheight (){
VaR FRM = Document. getelementbyid ("content01 ");
VaR subweb = Document. frames? Document. Frames ["content01" document .doc ument: FRM. contentdocument;
If (FRM! = NULL & subweb! = NULL ){
FRM. Height = subweb. Body. scrollheight;
}
}
// -->
</SCRIPT>
<IFRAME id = "content01" name = "content01" frameborder = 0 scrolling = No src = "main.html" width = "100%" onLoad = "tuneheight ()"> </iframe>
Method 2:
JS Code:Copy codeThe Code is as follows: // IFRAME adaptive height [passed the test in IE6 IE7]
Function resetiframe (){
VaR IFRAME = Document. getelementbyid ("iframeid ");
Try {
VaR bheight = iframe.content20.doc ument. Body. scrollheight;
VaR dheight = iframe.content?document.doc umentelement. scrollheight;
VaR Height = math. Max (bheight, dheight );
IFRAME. Height = height;
} Catch (Ex ){}
}
HTML:Copy codeThe Code is as follows: <IFRAME src = "" id = "Weather" name = "Weather" width = "278" onLoad = "resetiframe () "marginwidth =" 0 "marginheight =" 0 "scrolling =" no "frameborder =" 0 "border =" 0 "framespacing =" 0 "> </iframe>