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;
            
        }

原文地址:https://www.cnblogs.com/ayao/p/2397974.html