Fully compatible with IFRAME highly adaptive

Source: Internet
Author: User

I had to use IFRAME, So I struggled with IFRAME for a day. (Test browsers: IE6, IE7, IE8, and ff3.0)

Program code:

<Div class = "side_left">
<IFRAME src = http://www.webyi.com/wschool/wdesign/HTML/20091016/ "left.html" name = "leftframe" id = "leftframe" scrolling = "no" width = "170px" Height = "330px" frameborder = "0"> </iframe>
</Div>
<Div class = "content">
<IFRAME src = http://www.webyi.com/wschool/wdesign/html/20091016/ "right1.html" name = "mainframe" id = "mainframe" width = "740px" frameborder = "0" scrolling = "no"> </iframe>
</Div>

Typically, you can click the frame on the right of the menu on the left to display it. First, the target is clearly specified for the link, but it is opened in a new window under Firefox. It took a long time to troubleshoot and found that a very low-level error was useless </iframe>. Directly <IFRAME.../>. No problem in IE. FF quit ....
Then, the right frame automatically adapts to the height with the content. There are a lot of solutions on the Internet that seem to be usable. Solution: Execute Js in the onload event of IFRAME on the homepage to get the height of the contained page, and then synchronize the height.

Program code:

<IFRAME src = http://www.webyi.com/wschool/wdesign/HTML/20091016/ "right1.html" name = "mainframe" id = "mainframe" width = "740px" frameborder = "0" scrolling = "no"> </iframe>
<SCRIPT type = "text/JavaScript">
Function reinitiframe (){
VaR IFRAME = Document. getelementbyid ("mainframe ");
Try {
VaR bheight = iframe.content20.doc ument. Body. scrollheight;
VaR dheight = iframe.content?document.doc umentelement. scrollheight;
VaR Height = math. Max (bheight, dheight );
IFRAME. Height = height;
} Catch (Ex ){}
}
Window. setinterval ("reinitiframe ()", 200 );
</SCRIPT>

 

From: http://www.norkoo.com/show/Tech/Tech_HTML/adiekhjjakijhhdkiecbdkigfjkhdeb.aspx

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.