如何使用window.showModalDialog禁用浏览器关闭(X)按钮? [英] How to disable browser close(X) button using window.showModalDialog?

查看:622
本文介绍了如何使用window.showModalDialog禁用浏览器关闭(X)按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想在打开我的ModalDialog框时禁用窗口浏览器的close(X),它很小,并且包含确定"和关闭"按钮.

当用户单击关闭"按钮时,子页面应关闭.当他们单击浏览器关闭按钮时,它不应关闭.

Hi,

I want to disable the window browser close(X) while I am opening my ModalDialog box, which is small in size and contains buttons for OK and Close.

When the user clicks the ''Close'' button the child page should be closed. It should not get closed while they are clicking browser close button.

<script language="javascript" type="text/javascript">

        function Onclick()
        {


        RetVal = window.showModalDialog("CabinMappingChild.aspx","CabinMapping","dialogHeight: 190px; dialogWidth: 550px; titlebar: no; toolbar: no; statusbar:no");
        }
 </script>



我正在使用上面的代码,但仍然无法正常工作.




I am using the above code but still I could not get it to work.


Can anyone please help me?

推荐答案

出于安全原因,您不能在浏览器中禁用关闭按钮.

但是...您可以全屏打开窗口,这意味着浏览器将自动隐藏标题栏以及最小化,最大化和关闭按钮!

要以全屏模式打开网络表单,请参见以下内容:

window.open(''WebForm2.aspx'', '''', ''Fullscreen=yes'');


希望对您有所帮助!
You are not allowed to disable the close button in the browser for security reasons.

However... You can open the window in fullscreen size which means the browser automatically will hide the titlebar and the minimize, maximize, and close buttons!

To open a webform in fullscreen see below:

window.open(''WebForm2.aspx'', '''', ''Fullscreen=yes'');


Hope that helps!


在我的按钮单击事件上不起作用...
Its not working on my button click event...


您可以禁用父窗口. />
http://forums.asp.net/t/1212594.aspx/1 [ ^ ]
YOU CAN disable parent window.. See this link.

http://forums.asp.net/t/1212594.aspx/1[^]


这篇关于如何使用window.showModalDialog禁用浏览器关闭(X)按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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