IFRAME, especially the IFRAME without borders, is possible to update part of the page data without refreshing a new page because it can be seamlessly integrated with the webpage, however, the size of the IFRAME is not as flexible as that of the layer, which makes it difficult to use it. It is not good to set the height of the IFRAME when it is too large or less. Now, I finally learned how to adjust the height of the IFRAME dynamic body, mainly the following JS functions:
Function setcwinheight ()
{
VaR CWIN = Document. getelementbyid ("CWIN ";
If (document. getelementbyid)
{
If (CWIN &&! Window. Opera)
{
If (CWIN. contentdocument & CWIN. contentdocument. Body. offsetheight)
CWIN. Height = CWIN. contentdocument. Body. offsetheight;
Else if (CWIN. Document & CWIN. Document. Body. scrollheight)
CWIN. Height = CWIN. Document. Body. scrollheight;
}
}
}
Finally, add IFRAME and you cannot discard the onload attribute. Of course, the ID must also be matched by CWIN in the function.
<IFRAME width = "778" align = "center" Height = "200" id = "CWIN" name = "CWIN" onLoad = "javascript: setcwinheight () "frameborder =" 0 "scrolling =" no "> </iframe>