IE9下不能100%显示iframe问题的三种解决方法

来源:互联网 发布:mac快速接入 编辑:程序博客网 时间:2024/05/01 13:25
方法一:如果在IE8可以显示IE9显示不了,可以降低版本,让网页用低版本显示页面内容,但是其他的显示会受到影响。
(1)在<head>标签里增加如下内容: 
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" > 
(2)注释掉原先的html头: 
<!-- 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 

--> 

但是很奇怪。。第一次修改是可以的。。然后我想尝试下别的。。再改回去就不灵了


方法二:就是每次要把div的值找出来然后根据屏幕大小来设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    <style>
        body, html
        {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
        .content
        {
            width: 100%;
            height: 100%;
        }
        .contentframe
        {
            width: 100%;
            height: 100%;
        }
    </style>
 
    <script type="text/javascript">
        function setContentWidth() {
            document.getElementById("content").style.width = document.body.clientWidth - 250 + "px";
        }
    </script>
 
</head>
<body onload="setContentWidth();">
    <div style="width: 250px; height: 100%; float: left; background: #99C">
        <a href="2.htm" target="rightframe">fsdf</a><br />
        <a href="3.htm" target="rightframe">fsfsafsa</a>
    </div>
    <div style="float: left; background: #960; height: 100%; position: relative">
        <div class="content" id="content">
            <iframe scrolling="no" frameborder="0" src="2.htm" class="contentframe" name="rightframe"
                id="Iframe1"></iframe>
        </div>
    </div>
</body>
</html>

方法三:我最后用的办法是这样的

   <td width="100%" height="530px" align="center" valign="top"><iframe id="f2" name="f2" height="100%" width="100%" border="0" frameborder="0" src="../index-adv-admin.php"> 浏览器不支持嵌入式框架,或被配置为不显示嵌入式框架。</iframe></td>
  </tr>


直接设置了height的高度。。但是这样的话不同的尺寸就不行了,所以重新修改了一下。。

#forie{
height:530px;!impotant
}

就是放弃了IE能够自适应高度了。。只能在其他浏览器随便改变尺寸。。暂时就这样。。没什么好办法。。


0 0