开发者

window.dialogArguments is reset after postback in Firefox 3 showModalDialog function

The window.dial开发者_运维技巧ogArguments property is reset after a postback in Firefox 3. After a postback, and one attempts to set the window.dialogArguments property yields an error. On checking the property its value is undefined. This is weird since just when the modal window is opened the property seems to be created and can be accessed. This behaviour only happens after a postback. Is this a know bug with Firefox 3, since the method showModalDialog which is in IE since version 4 has just been implemented. How does one get around this?


If the window.dialogArguments property is undefined, you can use the object directly via window.opener.myObject:

OPENER

m_oArgs = new Object;
m_oArgs.Foo = "";
window.showModalDialog("http://myUrl/dialog.aspx", m_oArgs, 'dialogWidth:350px;dialogHeight:140px;');
alert(m_oArgs.Foo)

DIALOG

var DA = window.dialogArguments;
if (DA != null) {
    DA.Foo = "MyArgument";
} else {
    if ((!window.opener.closed) && (window.opener.m_oArgs)) {
        window.opener.m_oArgs.Foo = "MyArgument";
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜