<input type="button" value="test" onclick="window.opener=null;window.close();">

 

 

当我们用这种方法:Response.Write("<script>window.close()</script>")
总是提示什么:你查看的网页试图关闭的提示
如何去掉提示,直接关闭窗体?
可以用以下方法:
Response.Write("<script>window.opener=null;window.close()</script>")
只有ie6才支持.
opener只要设为任何值都可以,不会出现提示

 

如果是通过子窗体关闭父窗体时怎么做呢
子窗体(弹出窗体):
同理可得:
Response.Write("<script>window.opener.top.opener=null;window.opener.top.close()</script>")

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2022-12-23
猜你喜欢
  • 2021-07-10
  • 2021-12-21
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2021-09-30
相关资源
相似解决方案