iframe Frame self-adapting height

Source: Internet
Author: User

Ask:

There is a page niu.html code as follows

<iframe src=http://www.iiwnet.com/about.html ></iframe>

The height of the page is passed through the body of the about.html page, but I am now invoking something from a different website. Can't

Get his height on the page that was called: Do I have a way to implement the IFRAME automatically adjust the height in the niu.html page?


For:

Of course you can.

Important NOTE: src= you must fill in the Web address, must and this page in the same site, otherwise, will be wrong, said "Access Denied!" ”

Before I have encountered this problem, in order to get the answer to the online search, found that many people have encountered such problems, and now the solution to share

It's super simple!


1, create a iframe.js file, and then enter the following code (only two lines oh)

Parent.document.all ("Frame ID name"). style.height=document.body.scrollheight;//Get Height

Parent.document.all ("Frame ID name"). style.width=document.body.scrollwidth;//Get width

The frame ID Name here is the ID of the IFRAME, such as:

&lt;/ iframe&gt;&lt;/p&gt;


2. Add each of the included documents to your website


3, OK, call it off!

I passed the test under WinXP and IE6. It's simple!


iframe Frame self-adapting height

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.