首页 > 解决方案 > 使用 jQuery 从子窗口调用父窗口函数的问题?

问题描述

我打开一个这样的窗口:

var impressionWindow = window.open('index.php?module=Products&src_module=Oneidsousjob&src_field=sousjob_article&src_record=&view=Popup&triggerEventName=postSelection', 'Popup', 'scrollbars=1,resizable=1,height=560,width=770');

我尝试使用以下代码在父窗口中调用一个函数:

window.opener.postSelection();

但是子窗口说: Uncaught TypeError: window.opener.postSelection is not a function

我不知道为什么我会尝试其他方式,比如这些:

window.parent.postSelection();

结果是相同的 postSelection 不是一个函数或者是这样的事件:

window.parent.$(window.parent.document).trigger('postSelection');

没有任何事情发生......

布雷夫我需要一些帮助,非常感谢提前...

标签: jqueryparent-child

解决方案


推荐阅读