如何将数据传回父窗口? [英] How to pass data back to parent window?
本文介绍了如何将数据传回父窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找到了一个链接,显示如何将参数发送回开启者浏览器窗口。但它只适用于 window.showmodal()
。如果我使用 window.open()
对吗?应该有一个简单的方法来做同样的事情?
解决方案
如果您使用的是window.open,您可以在父窗口中调用一个函数,并将参数传递给该函数。
在子页面中javascript
var x =hello; //参数我想传递给父
窗口.opener.ParentPageFunctionName(X);
I found a link that shows how to send parameters back to the opener browser window. But it works only with window.showmodal()
. There should be an easy way to do the same if I use window.open()
right?
解决方案
If you are using window.open, you can call a function in the parent window and pass in pararmeters to that function.
Do this in child page javascript
var x="hello";//parameter I want to pass to the parent
window.opener.ParentPageFunctionName(x);
这篇关于如何将数据传回父窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文