0

我正在使用以下代码打开一个子窗口:

window.showModalDialog("FileUpload.aspx", "FileUpload", 
    "center:yes;resizeable=yes;dialogHeight:300px;dialogWidth:600px;");

我将在子窗口(FileUpload.aspx)中上传的文件保存在 FileUpload.vb 页面后面的代码中。由于服务器端代码,它的回发和打开一个新的浏览器。

在子窗口中使用我的功能后,当我使用下面的代码关闭它时,

window.open('', '_self', '');
window.close();

它正在关闭由于回发而打开的新浏览器,但在返回父页面时仍打开同一子窗口的副本。

我想关闭这个子窗口的所有实例。

4

1 回答 1

0

The showModalDialog method will freeze JavaScript execution on the parent window until the dialog that it opens has closed, so we can rule out that as the reason why your second window opens. When FileUpload.aspx posts back from the server, it should work the same way as modeless aspx postbacks.

I think you should be able to get rid of the window.open() method and you should be fine.

Parent window:

window.showModalDialog("FileUpload.aspx", "FileUpload", 
    "center:yes;resizeable=yes;dialogHeight:300px;dialogWidth:600px;");

The Child window will call this when it's done.

window.close();
于 2013-08-08T20:33:34.813 回答