在父页面用B.Element.click()事件就可以调用得到了

解决方案 »

  1.   

    还不够清楚吗?A,B都是子页面,但是不同域,在A能不能调用B的js。
      

  2.   

    http://farthinker.cn/2007/12/22/cross-domain-visit/
      

  3.   

    做个 webservice 实现下 功能算了
      

  4.   

    引用 8 楼 benjamin_liu 的回复:
    如果B页面不需要登录就可以访问的话是没问题的 
     
    但是不在一个域啊 ,好像不能数据传递==============================================
    如果是IE浏览器,可以通过response在header加入,如(注意我这是jsp的写法):
    response.addHeader("P3P","CP=CAO PSA OUR");
      

  5.   

    你不要再浪费这个时间了,换其它思路吧,如在服务端用http请b域再返回frameb,这样a和b 都是同域了 ,这样你想怎样操作都可以了
      

  6.   

    我刚好做个跨域调用的例子我是通过动态生成script块实现的,希望对你有帮助我觉得肯定是可以实现的
      

  7.   


    我的例子当然成功了,不过跟LZ的有点区别在于,我是在A站点获取B站点的数据,而不是用A上的 button触发B上的onclick事件
    说下我的实现思路:
    script块的src是可以跨域调用的,既然这样,我们用服务端生成特定的脚本块,然后由另外的站点客户端调用即可不过我还真没校验其他浏览器,IE下通过测试我觉得LZ可以换个思路,为什么看一定要用A上的button实现B上的Onclick?用其他的数据交互方式不可以?
      

  8.   

    直接用JS 是没有办法的。(从安全角度来考虑)向什么Ajax代理,webservice 这些都是走的是后台。
    LZ 随便选一个来用吧。
      

  9.   

    JSP试过做过类似的问题.不知道ASP.NET行不行.
    A.parent.B.Element.click();但是如果想将A的FORM数据提交到B就需要做处理了.
      

  10.   

    假设你的域叫做:A.xxxxx.com, B.xxxxx.com在A和B的页面中都要写一句js:
    <script>document.domain='xxxxx.com';</script>然后就不会Access is denied了,就可以像同一个域的页面一样互相访问。
    domain Property  Internet Development Index --------------------------------------------------------------------------------Sets or retrieves the security domain of the document. Syntaxdocument.domain [ = sDomain ]
    Possible ValuessDomain String that specifies or receives the domain suffix. The property is read/write. The property has no default value.Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.ResThe property initially returns the host name of the server from which the page is served. The property 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 initially would not be able to communicate with each other. However, by setting the domain property of both pages to the suffix "microsoft.com", you ensure that both pages are considered secure and access is available between the pages. When you set the domain property, use the domain name determined by the server rather than by the client browser. All the pages on different hosts must have the domain property explicitly set to the same value to communicate successfully with each other. For example, the value of the domain property of a page on the host microsoft.com would be "microsoft.com" by default. It might seem logical that if you set the domain property of a page on another host named msdn.microsoft.com to "microsoft.com," that the two pages could communicate with each other. However, this is not the case unless you have also explicitly set the domain property of the page on microsoft.com to "microsoft.com". Furthermore, this property cannot be used to allow cross-frame communication among frames with different domain suffixes. For example, a page in one frame from www.microsoft.com and a page in another frame from www.msn.com would not be able to communicate with each other even if the domain property of both pages was set to the suffix "microsoft.com". Security Alert  Using this property incorrectly can compromise the security of your Web site. Set the domain property only if you must allow cross-domain scripting. Use a value determined on the server. Setting this property to a value determined on the client (like through the location object) could expose your site to attack from another site through Domain Name System (DNS) manipulation. For more information, see Security Considerations: Dynamic HTML.
    For more information on domain security, see About Cross-Frame Scripting and Security.Standards InformationThis property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 
      

  11.   

    跨域是两个窗口运行在不同的域中, 你所说的只是A域加载了B域的JS文件 , 当这个JS文件加载到A域时其实已经是A的代理,运行环境也完成是A域的, 跟B域没有一点关系,当然也不能再操作B域窗口中的任何东西, 明白没有
      

  12.   

    上面打错:当这个JS文件加载到A域时其实已经是A的代理
    应该是:当这个JS文件加载到A域时其实已经是A域的代码