window.opener替代品 [英] window.opener alternatives

查看:139
本文介绍了window.opener替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在打开一个模态弹出窗口。然后我使用 window.opener 访问父窗口文本框和其他属性。它在Firefox中运行良好,但在IE8中运行不正常。它给出错误'window.opener is null'。如何在两个浏览器中的子窗口中访问父窗口属性。

I am opening a modal popup window. Then I access a parent window textbox and other attributes using window.opener. It is working fine in firefox but not in IE8. It gives error 'window.opener is null'. How can I access parent window attributes in child window which works in both browsers.

推荐答案

您可以将参数传递给showModalDialog函数。只需将window对象作为参数传递。

You can pass arguments to showModalDialog function. Simply pass window object as an argument.

window.showModalDialog(theURL, window);

Yo可以使用dialogArguments从模态窗口访问参数。请参阅: http://msdn.microsoft.com/en-us/library/ ms533723%28VS.85%29.aspx

Yo can access the arguments from the modal window using dialogArguments. See: http://msdn.microsoft.com/en-us/library/ms533723%28VS.85%29.aspx

var openerWindow = window.dialogArguments;

这篇关于window.opener替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆