Deep analysis of Contentwindow, contentdocument

Source: Internet
Author: User
There is no eternal technology only abnormal demand, not to say that the client only helpless developers, if the appearance of the IFRAME is a mistake, iframe inside in to an IFRAME that is wrong on the wrong, the myth is not in the ancient Madding crowd disappeared, but in the bosom of today constantly staged

Life is always a big dyeing tank, a piece of white cloth down, black cloth out, a black cloth down, a piece of seven knitted fabric out.
Contentwindow compatible with individual browsers, you can get window objects for child windows.
Contentdocument Firefox supports,> IE8 's IE support. The document object for the child window can be obtained.
Set the parent iframe in the child iframe, or the height of the sun-level iframe.

Copy Code code as follows:


function Showiframeh () {


var Parentwin = parent.document.getElementById ("test");


if (!parentwin) return false;


var sub = parentWin.contentWindow.document.getElementById ("Test2");


if (!sub) return false;


var thirdheight = sub.contentWindow.document.body.offsetHeight; Third Layer Body Object


sub.height = thirdheight; Set the height of the second layer of IFRAME


var secondheight = x.contentwindow.document.body.offsetheight; Second Layer Body Object


x.height = secondheight; Set the height of the first layer of IFRAME


//alert (secondheight);


//alert (' body: ' + x.contentdocument.body.offsetheight + ' div: ' + thirdheight);


}

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.