Create highly dynamic IFRAME

Source: Internet
Author: User
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.