How to dynamically adjust the iframe height using javascript _ javascript skills

Source: Internet
Author: User
Using javascript to dynamically adjust the iframe height when you use iframe on the page, you generally do not want the iframe to display an ugly scroll bar, to integrate the content in iframe with the content on the home page. At this time, you will set the scrolling = "no" attribute. However, if the content in the iframe changes and the height changes, your iframe will become too long, leading to a large blank space, or, on the contrary, some content is blocked because the iframe height is too small. Here I provide a javascript script compatible with IE, NS, and Firefox to dynamically adjust the iframe height. If you need to adjust the width, the principle is the same. This article will not detail it.

First, you must include the following javascript code on your home page:

The Code is as follows:


Related Article

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.