首页 > 其他 > 详细

Iframe知识点

时间:2015-08-28 19:26:05      阅读:277      评论:0      收藏:0      [点我收藏+]

  var oIframe=document.getElementById(‘iframe1‘); 获取iframe对象;
   oIframe.contentWindow.//  iframe 里的window对象

 oIframe.contentDocument.//ifram里的document对象

从iframe里操作父层页面的元素;
        window.parent.document..获取父层页面的文档对象;

   window.parent.window..获取父层页面的window对象;

window.top.document.getElementById(...);获取iframe最顶层的父元素节点;

 

var oIframe=document.createElement(‘iframe‘);
        oIframe.src=‘iframe1.html‘;
        document.body.appendChild(oIframe);
        oIframe.onload=function(){
            
        }//页面iframe  onload加载完成事件;//
        但是在IE下iframe的onload事件只能用绑定的形式 oIframe.attachEvent(‘onload‘,function(){..})

防止网站被人拿去当钓鱼网站: 

   if(window!=window.top)
            {
                window.top.location.href=window.location.href
            }

Iframe知识点

原文:http://www.cnblogs.com/isylar/p/4767111.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!