呵呵,又见楼主。参考《Javascript权威指南》 P450
或上网搜索“同源策略”domain指documnet.domain
如,可以将orders.acme.com 和catalog.acme.com的document.domain设置成acme.com,但不能设置成xxxx.com

解决方案 »

  1.   

    document.domain 文档的安全域名
      

  2.   

    domain--------------------------------------------------------------------------------描述:
    设置或获取文档的安全域名。语法:
    object.domain[ = domain]设置(很简单的E文,希望你能看懂):This read-write property initially returns the host name of the server the page is from. It can be assigned the domain suffix to allow sharing of pages across frames. For example, a page in one frame from home.microsoft.com and a page from www.microsoft.com would initially not be able to communicate with each other. However, by setting the domain property of both pages to the suffix, microsoft.com, both pages would be considered secure and now access is available between the pages. 应用:
    document 
      

  3.   

    这和浏览器的安全策略有关,
    当两个页面在进行数据交换时,浏览器会首先比较两个页面的 domain 属性,如果 domain 属性相同,那么浏览器就允许它们之间的数据交换,否则就返回“拒绝访问(Access Denied)”的错误。通过蒙蔽浏览器,让它认为两个页面的 domain 属性相同从而实现两个不同域的页面之间的数据交换
    。在 JavaScript 中我们可以通过在页面中加入如下声明来强制指定页面所属的域。<script language="JavaScript">
    <!--
    document.domain = "mycompany.com"; //指定 document 所属的域
    -->
    </script>