zoukankan      html  css  js  c++  java
  • iframe(跨页面父子页面问题)

     <iframe id="iframe1" data-bind="attr: { src: $root.Basic_Form_ReportID }" frameborder="0" style="height: 550px;100%"></iframe>

    self.CreatCustomCss = function (content) {
    var oCss = document.getElementById("CustomCss");
    oCss.innerHTML += content;
    }

    //注册Iframe加载完成事件,支持2个Iframe Start
    var iframe = document.getElementById("iframe1");
    if (iframe) {
    if (iframe.attachEvent) {
    iframe.attachEvent("onload", function () {
    if (afterIfrma1Loaded) afterIfrma1Loaded();
    });
    } else {
    iframe.onload = function () {
    if (afterIfrma1Loaded) afterIfrma1Loaded();
    };
    }
    }

    //加载自定义样式
    document.write("<style id='CustomCss'></style>");

    function afterIfrma1Loaded() {
    var css = ".inblock2{33% !important}";

    document.getElementById("iframe1").contentWindow.viewModel.CreatCustomCss(css)
    }

  • 相关阅读:
    7.Mongodb安全性流程
    6.Mongodb索引
    5.Mongodb聚合
    8-进程管理
    7-安装包管理
    6-文件系统
    5-权限用户组
    27-ATM+购物车程序
    26.本章小结
    名词解释
  • 原文地址:https://www.cnblogs.com/benbenjia/p/9480221.html
Copyright © 2011-2022 走看看