博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
今天碰到IE的一个问题, 两个IFRAME的问题
阅读量:2059 次
发布时间:2019-04-29

本文共 2661 字,大约阅读时间需要 8 分钟。

    <div id="tabPanel">            
            <iframe id="tabLeft" width="473" height="230" allowtransparency="true" frameborder="0" scrolling="no" src="../../resource/plugins/twoTabs/interviewOnline!showNewInterivew.action?siteId=562&role=1&videoType=0" style="float:left;"></iframe>
                  <script type="text/javascript">
                                function reinitIframe(){
                                    var iframe = document.getElementById("tabLeft");
                                    try{
                                        var bHeight = iframe.contentWindow.document.body.scrollHeight;
                                        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
                                        var height = Math.max(bHeight, dHeight);
                                        iframe.style.height = height+"px";
                                    }catch (ex){}
                                    
                                    }
                                window.setInterval("reinitIframe()", 200);
                </script>
                
                
              <iframe id="tabRight" width="287" height="230" allowtransparency="true" frameborder="0" scrolling="no" src="../../resource/plugins/twoTabs/onlineInvestigate.jsp" style="float:right;"></iframe>
                  <script type="text/javascript">
                                function reinitIframe(){
                                    var iframe = document.getElementById("tabRight");
                                    try{
                                        var bHeight = iframe.contentWindow.document.body.scrollHeight;
                                        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
                                        var height = Math.max(bHeight, dHeight);
                                        iframe.style.height = height+"px";
                                    }catch (ex){}
                                    
                                    }
                                window.setInterval("reinitIframe()", 200);
                </script>    

          </div>

这样子的话, 在IE7下刷新页面两个IFRAME会窜调, 我这里是第一个IFRAME的内容覆盖了第二个, 然后找了大半天原因, 火狐下是没有问题的, 怀疑是不是IE内核读取方式有问题, 不能在一个DIV里写两个IFRAME, 于是呼把两个IFRAME各自写到自己的DIV里, 问题解决。

    <div id="tabPanel">            

             <div>

            <iframe id="tabLeft" width="473" height="230" allowtransparency="true" frameborder="0" scrolling="no" src="../../resource/plugins/twoTabs/interviewOnline!showNewInterivew.action?siteId=562&role=1&videoType=0" style="float:left;"></iframe>
                  <script type="text/javascript">
                                function reinitIframe(){
                                    var iframe = document.getElementById("tabLeft");
                                    try{
                                        var bHeight = iframe.contentWindow.document.body.scrollHeight;
                                        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
                                        var height = Math.max(bHeight, dHeight);
                                        iframe.style.height = height+"px";
                                    }catch (ex){}
                                    
                                    }
                                window.setInterval("reinitIframe()", 200);
                </script>

</div>

                
                       <div>
              <iframe id="tabRight" width="287" height="230" allowtransparency="true" frameborder="0" scrolling="no" src="../../resource/plugins/twoTabs/onlineInvestigate.jsp" style="float:right;"></iframe>
                  <script type="text/javascript">
                                function reinitIframe(){
                                    var iframe = document.getElementById("tabRight");
                                    try{
                                        var bHeight = iframe.contentWindow.document.body.scrollHeight;
                                        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
                                        var height = Math.max(bHeight, dHeight);
                                        iframe.style.height = height+"px";
                                    }catch (ex){}
                                    
                                    }
                                window.setInterval("reinitIframe()", 200);
                </script>    

       </div>

          </div>

转载地址:http://fvalf.baihongyu.com/

你可能感兴趣的文章
hibernate 时间段查询
查看>>
java操作cookie 实现两周内自动登录
查看>>
Tomcat 7优化前及优化后的性能对比
查看>>
Java Guava中的函数式编程讲解
查看>>
Eclipse Memory Analyzer 使用技巧
查看>>
tomcat连接超时
查看>>
谈谈编程思想
查看>>
iOS MapKit导航及地理转码辅助类
查看>>
检测iOS的网络可用性并打开网络设置
查看>>
简单封装FMDB操作sqlite的模板
查看>>
iOS开发中Instruments的用法
查看>>
iOS常用宏定义
查看>>
被废弃的dispatch_get_current_queue
查看>>
什么是ActiveRecord
查看>>
有道词典for mac在Mac OS X 10.9不能取词
查看>>
关于“团队建设”的反思
查看>>
利用jekyll在github中搭建博客
查看>>
Windows7中IIS简单安装与配置(详细图解)
查看>>
linux基本命令
查看>>
BlockQueue 生产消费 不需要判断阻塞唤醒条件
查看>>