Bug about IFRAME not displayed in IE6

Source: Internet
Author: User

Internet Explorer is out of Internet Explorer 8, and fewer people are using Internet Explorer 6, but they still exist. For example, qamm is in use.

Therefore, the problems in IE6 must also be solved. In the past two days, I met one:

 

Html
< Table >
< Tr >
< TD ID = "Tdtest" Runat = "Server" >
< IFRAME ID = "Ifrtest"   Height = "100%" Runat = "Server" > </ IFRAME >
</ TD >
</ Tr >
</ Table >

 

Code
Protected   Void Page_load ( Object Sender, eventargs E)
{
This . Ifrtest. Attributes. Add ( " SRC " , " Ie6.aspx " );
}

 

Very simpleCodeIt is very simple to nest an IFRAME and bind IFRAME to the background to display the page content. However, such a simple code will not be displayed in IE6 !!

Why? This is where the problem occurs.Height= "100%"In IE6, I do not know whether to get the height or get the TD's original 0 before the SRC value. It will not be displayed anyway.

Knowing the problem is simple... There are n solutions:

1. RemoveHeight= "100%"However, it is not satisfactory to set the IFRAME height.

2. Set a fixed value for TD or IFRAME in the background:

 

Code2
This. Tdtest. Height= "200px";

 

3. The front-end dynamically sets the IFRAME height:

 

Code3
This. Ifrtest. Attributes. Add ("Onload","Iframeautoheight (this)");

 

The front-end must add: (the following section of JS comes from the Network)

 

Script
Function Iframeautoheight (OBJ)
{
VaR ID = OBJ. ID;
VaR Subweb = Document. Frames ? Document.frames[id).doc ument: obj. contentdocument;
If (OBJ ! =   Null   && Subweb ! =   Null )
{
OBJ. Height = Subweb. Body. scrollheight;
}
}

 

4. Think about it ....

 

In addition, it is said on the Internet that the SCR attribute in IE6 cannot be displayed at the top, but I cannot try it out. If anyone knows, please advise: kenblove # gmail.com

 

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.