zoukankan      html  css  js  c++  java
  • 动态更改iframe src

    最近使用iframe 做项目,在动态更改Src的时候,要么IE6 IE7支持 要么Chrome不支持。崩溃中。

    没有办法只能使用最简单的判断办法,重复造轮子吧。

            function ChangeIframeSrc(url) {
                $("#RightTD_setup", window.parent.document).html('<iframe frameborder="0" name="RightContent" id="RightContent"  style="margin:0px; padding:0px;"  scrolling="no" width="100%"     src="' + url + '" allowTransparency="true"></iframe>');
                if ($("#RightContent", window.parent.document).contents().find("body").height() == undefined) { //针对IE6,7,8单独做
                    window.parent.document.getElementById('RightTD_setup').innerHTML = "";
                    var el = document.createElement("iframe");
                    el.id = "RightContent";
                    el.scrolling = "no";
                    el.allowTransparency = "true";
                    el.src = '' + url + '';
                    el.frameBorder = "0";
                    window.parent.document.getElementById('RightTD_setup').appendChild(el);
                }
                $("#RightContent", window.parent.document).css("width", "670px");
                var marginheiht = 0;
                marginheiht = $("#RightContent", window.parent.document).contents().find("body").height()
                if (marginheiht < 550) {
                    marginheiht = 550;
                }
    
                $("#RightContent", window.parent.document).height(marginheiht);
            }

    呵呵代码很丑陋,刚刚测试成,目前修改中,希望路过的大牛,帮忙解决下,不再重复造轮子

  • 相关阅读:
    Python 文件操作
    Python 操作 sqlite
    Python中的random模块
    Linux系统下的/etc/nsswitch.conf文件
    Python 列表/元组/字典总结
    快斗之翼:python2的print和python3的print()
    田小计划:图解Python深拷贝和浅拷贝
    Python 自省指南
    Python运算符优先级
    tc: 模拟网络异常的工具
  • 原文地址:https://www.cnblogs.com/flyfish2012/p/3049610.html
Copyright © 2011-2022 走看看