如何从父窗口关闭子窗口按钮在asp.net中单击? [英] How to close child window from parent window button click in asp.net?

查看:177
本文介绍了如何从父窗口关闭子窗口按钮在asp.net中单击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从父窗口关闭子窗口按钮单击asp.net?

解决方案

这是 Window.close()。请注意, window.close()将适用于当前窗口;但是1)它不适用于所有情况和2)不是你需要的。



父和孩子可能意味着你创建了一些窗口你称之为父母。执行此操作时,您将收到新创建的窗口的窗口对象引用。您需要保留此引用以便稍后使用新窗口对象,并将其关闭:

  var  myChild =  window  .open( / *   .. 。* / 

// 以及

myChild.close()





请参阅:

https://developer.mozilla.org/en-US/docs/Web/API/Window/open [ ^ ] ,

https://developer.mozilla.org/en -US / docs / Web / API / Window / close [ ^ ]。



请注意,浏览器可以阻止创建弹出窗口。



-SA

How to close child window from parent window button click in asp.net?

解决方案

This is Window.close(). Note that window.close() would work on a current window; but 1) it won't work in all cases and 2) not what you need.

"Parent" and "child" probably means that you created some window from what you call "parent". When you do so, you will receive the window object reference for the newly created window. You will need to preserve this reference to use the new window object later on, and to close it:

var myChild = window.open(/* ... */)

// and later

myChild.close()



Please see:
https://developer.mozilla.org/en-US/docs/Web/API/Window/open[^],
https://developer.mozilla.org/en-US/docs/Web/API/Window/close[^].

Note that creation of popup windows can be blocked by the browser.

—SA


这篇关于如何从父窗口关闭子窗口按钮在asp.net中单击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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