zoukankan      html  css  js  c++  java
  • iframe操作

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <title>Document</title>
    <script type="text/javascript">
    window.onload = function(){
        var oInput = document.getElementById('input1');
        var oIframe = document.getElementById('iframe1');
    
        oInput.onclick = function(){
            //oIframe.contentWindow.document.getElementById('div1').style.color = 'red';//所有浏览器都支持
            oIframe.contentDocument.getElementById('div1').style.color = 'red';//ie6 7不支持
    
        }
    
        /*其他的一些操作:
        window.parent:表示父层的window
        window.top:表示最顶层的window
        注意iframe的onload事件在ie下只能用绑定的形式,attachEvent('onload',function(){});
    
        防钓鱼:
        if(window!=window.top){
            window.top.location.href = window.location.href;
        }*/
    }
    </script>
    </head>
    <body>
        <input type="button" value="改变" id="input1" />
        <iframe src="iframe1.html" id="iframe1"></iframe>
    </body>
    </html>
  • 相关阅读:
    按年按月分组查询
    dir listing 目录文件列表索引
    ps/sql developer 登录远程服务器
    Sql 基础问题
    数组的ES6,ES7的方法
    release中技术点的定义
    数仓面试
    项目总体分析
    spark
    dmp准备工作
  • 原文地址:https://www.cnblogs.com/toodeep/p/4476144.html
Copyright © 2011-2022 走看看