zoukankan      html  css  js  c++  java
  • [JavaScript]iframe的contentWindow

    HTMLIFrameElement.contentWindow返回的是HTMLIFrameElement类型元素的window对象

    通过此对象可以修改iframe实体内的window行为

    <iframe id="fr1" width="200" height="200" ></iframe>  
    <script>
    var theDoc = document.getElementById('fr1').contentWindow;  
    //theDoc.style.display = "block";   
       //theDoc.document.open(); //会自动打开  
         
       //theDoc.document.designMode = "on"; //会自动打开  
       theDoc.document.write('<html><head>');   
       //theDoc.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');   
    theDoc.document.write('</head><body width="100%" contentEditable=true style="padding:0;margin:0; overflow:hidden;" mce_style="padding:0;margin:0; overflow:hidden;">');   
       theDoc.document.write("lfasjdfkjalsejioruw fskdjfla;sjdkjfsahgasjdla;kjeioujrfhfaksdjfjal;skdjfhgsadlkfjla");   
       theDoc.document.write('</body></html>');   
       theDoc.document.body.contentEditable="false"; //要显示关闭可以编辑状态,不然内容是可以编辑的  
    </script>
  • 相关阅读:
    标准输入输出
    UNIX基础概念
    phpstrom设置php环境
    nginx+php+swoole安装记录
    MySQL索引
    生成器来解决大文件读取,大数据下载
    PHP调优
    PHP-FPM详解
    远程登录服务器配置
    HTTPS配置
  • 原文地址:https://www.cnblogs.com/yiyide266/p/9378340.html
Copyright © 2011-2022 走看看