javascript获取iframe框架中加载的页面document对象

javascript获取iframe框架中,加载的页面document对象

因为浏览器安全限制,对跨域访问的页面,其document对象无法读取、设置属性

 

       function getDocument(iframe)
        {
            var Doc;
            try{
                Doc = iframe.contentWindow.document;// For IE5.5 and IE6
            }
            catch(ex){}
            
            if(!Doc)
            {
                Doc = iframe.contentDocument;// For NS6
            }

            return Doc;
            
        }

posted on 2012-03-15 14:00  ayao  阅读(3384)  评论(0编辑  收藏  举报

导航