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);
            }

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

  • 相关阅读:
    mark::开源绘图工具graphviz
    bzoj1013球形空间产生器sphere 高斯消元(有系统差的写法
    背包专题练习
    仿射加密与S-DES加密算法的实现
    1178:成绩排序
    1177:奇数单增序列
    1176:谁考了第k名
    1311:【例2.5】求逆序对
    1310:【例2.2】车厢重组
    1175:除以13
  • 原文地址:https://www.cnblogs.com/flyfish2012/p/3049610.html
Copyright © 2011-2022 走看看