<i id='s8XCV'><tr id='s8XCV'><dt id='s8XCV'><q id='s8XCV'><span id='s8XCV'><b id='s8XCV'><form id='s8XCV'><ins id='s8XCV'></ins><ul id='s8XCV'></ul><sub id='s8XCV'></sub></form><legend id='s8XCV'></legend><bdo id='s8XCV'><pre id='s8XCV'><center id='s8XCV'></center></pre></bdo></b><th id='s8XCV'></th></span></q></dt></tr></i><div id='s8XCV'><tfoot id='s8XCV'></tfoot><dl id='s8XCV'><fieldset id='s8XCV'></fieldset></dl></div>

    <tfoot id='s8XCV'></tfoot>

  1. <legend id='s8XCV'><style id='s8XCV'><dir id='s8XCV'><q id='s8XCV'></q></dir></style></legend>

    <small id='s8XCV'></small><noframes id='s8XCV'>

      <bdo id='s8XCV'></bdo><ul id='s8XCV'></ul>
    1. 从父窗口中的子窗口运行函数

      run function from child window in parent window(从父窗口中的子窗口运行函数)

          <legend id='ZItNp'><style id='ZItNp'><dir id='ZItNp'><q id='ZItNp'></q></dir></style></legend>

              • <bdo id='ZItNp'></bdo><ul id='ZItNp'></ul>
                  <tbody id='ZItNp'></tbody>

                <small id='ZItNp'></small><noframes id='ZItNp'>

                <tfoot id='ZItNp'></tfoot>

                <i id='ZItNp'><tr id='ZItNp'><dt id='ZItNp'><q id='ZItNp'><span id='ZItNp'><b id='ZItNp'><form id='ZItNp'><ins id='ZItNp'></ins><ul id='ZItNp'></ul><sub id='ZItNp'></sub></form><legend id='ZItNp'></legend><bdo id='ZItNp'><pre id='ZItNp'><center id='ZItNp'></center></pre></bdo></b><th id='ZItNp'></th></span></q></dt></tr></i><div id='ZItNp'><tfoot id='ZItNp'></tfoot><dl id='ZItNp'><fieldset id='ZItNp'></fieldset></dl></div>
                本文介绍了从父窗口中的子窗口运行函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有两个窗口:parentpopup.显然 parent 有对 popup 的引用.现在在 popup 我有一个函数说

                I have two windows: the parent and the popup. Obviously parent has a reference to popup. Now in popup I have a function say

                function test() { alert('test'); }
                

                我想在 parent 中调用这个函数,类似于 popup.test();.有没有办法做到这一点?我确实知道如何反过来做.只是声明

                and I want to call this function in parent, something like popup.test();. Is there a way to do that? I do know how to do that the other way around. Just declaring

                window.test = function() { alert('test'); }
                

                并在弹出窗口中调用 window.opener.test(); 工作正常.但是,这在我的情况下不起作用(我认为因为 window.opener 对象是一个引用,但是 window.openwindowpopup 并不真正相关).有什么想法吗?

                and calling window.opener.test(); in popup works fine. However this does not work in my case (I think because the window.opener object is a reference, but window.open and window in popup are not really related). Any ideas?

                推荐答案

                这实际上取决于您为弹出窗口定义函数的上下文.假设您将函数/数据附加到弹出窗口的 window 对象,您可以从 window.open 返回的窗口句柄(窗口句柄 弹出窗口的window对象):

                It really depends on the context where you defined the function for the popup window. Assuming you attached the functions/data to the window object of the popup window, you can access it from the window handle returned by window.open (the window handle is the window object for the popup):

                var w = window.open(somelocation,''); //has a function on `window` called "test"
                w.test();
                

                我假设您了解安全沙箱如何用于弹出窗口

                这篇关于从父窗口中的子窗口运行函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)
                <legend id='pgz4R'><style id='pgz4R'><dir id='pgz4R'><q id='pgz4R'></q></dir></style></legend>

                    <tbody id='pgz4R'></tbody>

                      <i id='pgz4R'><tr id='pgz4R'><dt id='pgz4R'><q id='pgz4R'><span id='pgz4R'><b id='pgz4R'><form id='pgz4R'><ins id='pgz4R'></ins><ul id='pgz4R'></ul><sub id='pgz4R'></sub></form><legend id='pgz4R'></legend><bdo id='pgz4R'><pre id='pgz4R'><center id='pgz4R'></center></pre></bdo></b><th id='pgz4R'></th></span></q></dt></tr></i><div id='pgz4R'><tfoot id='pgz4R'></tfoot><dl id='pgz4R'><fieldset id='pgz4R'></fieldset></dl></div>
                      • <bdo id='pgz4R'></bdo><ul id='pgz4R'></ul>
                        • <small id='pgz4R'></small><noframes id='pgz4R'>

                          <tfoot id='pgz4R'></tfoot>