1. <small id='QOFgA'></small><noframes id='QOFgA'>

    <legend id='QOFgA'><style id='QOFgA'><dir id='QOFgA'><q id='QOFgA'></q></dir></style></legend>
  2. <i id='QOFgA'><tr id='QOFgA'><dt id='QOFgA'><q id='QOFgA'><span id='QOFgA'><b id='QOFgA'><form id='QOFgA'><ins id='QOFgA'></ins><ul id='QOFgA'></ul><sub id='QOFgA'></sub></form><legend id='QOFgA'></legend><bdo id='QOFgA'><pre id='QOFgA'><center id='QOFgA'></center></pre></bdo></b><th id='QOFgA'></th></span></q></dt></tr></i><div id='QOFgA'><tfoot id='QOFgA'></tfoot><dl id='QOFgA'><fieldset id='QOFgA'></fieldset></dl></div>

        <bdo id='QOFgA'></bdo><ul id='QOFgA'></ul>
      <tfoot id='QOFgA'></tfoot>
    1. 如何知道模态框(警报、提示、确认...)是否已在 javascript 中被禁用?

      how to know whether modal boxes (alert, prompt, confirm...) have been disabled in javascript?(如何知道模态框(警报、提示、确认...)是否已在 javascript 中被禁用?)

              <legend id='umMBK'><style id='umMBK'><dir id='umMBK'><q id='umMBK'></q></dir></style></legend>
              <i id='umMBK'><tr id='umMBK'><dt id='umMBK'><q id='umMBK'><span id='umMBK'><b id='umMBK'><form id='umMBK'><ins id='umMBK'></ins><ul id='umMBK'></ul><sub id='umMBK'></sub></form><legend id='umMBK'></legend><bdo id='umMBK'><pre id='umMBK'><center id='umMBK'></center></pre></bdo></b><th id='umMBK'></th></span></q></dt></tr></i><div id='umMBK'><tfoot id='umMBK'></tfoot><dl id='umMBK'><fieldset id='umMBK'></fieldset></dl></div>
                <tbody id='umMBK'></tbody>

              <small id='umMBK'></small><noframes id='umMBK'>

                <bdo id='umMBK'></bdo><ul id='umMBK'></ul>
                <tfoot id='umMBK'></tfoot>
                本文介绍了如何知道模态框(警报、提示、确认...)是否已在 javascript 中被禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个基于网络的私人应用程序,有时我会真诚地询问用户在特定情况下他们想做什么.为此,我使用了 javascript 的 confirm 函数.

                I have a private web based app where sometimes I genuinely ask to the users what they want to do in given situations. To do so, I'm using the confirm function of javascript.

                与任何其他模态框一样,在弹出几个弹出窗口后,用户只需单击小框即可选择禁用它们,如下所示:

                As any other modal box, after a few popups the user has the choice to disable them by simply clicking the little box as showed below:

                问题是,如果他们点击一次,他们永远不会看到其他消息,并且对 confirm 的响应被假定为 0,这很令人困惑,因为基本上这意味着所有需要他们确认的动作被取消,没有任何警告!刷新页面没有帮助,他们必须关闭它并重新打开它才能再次工作.

                The problem is that, if they clicked it once, they never see other messages and responses to confirm are assumed 0, which is confusing because basically it means that all the actions requiring their confirmation are cancelled with no warning! Refreshing the page does not help, they have to close it and reopen it for it to work again.

                我可以检测到他们何时检查了那个小盒子吗?

                Can I detect when they checked that little box?

                推荐答案

                选中该框后,对话框立即关闭".你可以检查一下盒子是否关闭得异常快:

                When that box is checked, the dialog "closes" immediately. You could check to see if the box closes unusually fast:

                function dialog(message, success, failure) {
                    var open_time = new Date();
                    var result = alert(message);
                    var close_time = new Date();
                
                    if (close_time - open_time < 10) {
                        failure();
                    } else {
                        success(result);
                    }
                }
                
                dialog('Hello', function(result) {
                    // The dialog probably was closed by the user
                }, function() {
                    // The dialog was closed really fast.
                    // Either the user was typing while it popped up or the browser didn't
                    //  display it in the first place
                });
                

                虽然只使用 CSS 和 HTML 创建模式对话框可能会更容易且跨浏览器和平台更一致.我个人不喜欢 Chrome 的做法.

                Although just using CSS and HTML to create modal dialogs would probably be much easier and more consistent across browsers and platforms. I personally don't like Chrome's approach.

                演示:http://jsfiddle.net/tS9G6/4/

                我稍微查看了 Chromium 的源代码,该属性并未存储在任何地方,因此似乎没有您可以查看的某些特定于 Chromium 的属性.

                I looked a little bit through Chromium's source and that property isn't stored anywhere, so there doesn't seem to be some Chromium-specific property that you can look at.

                这篇关于如何知道模态框(警报、提示、确认...)是否已在 javascript 中被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                What are valid deviceNames for Chrome emulation testing with Protractor?(使用 Protractor 进行 Chrome 模拟测试的有效设备名称是什么?)
                Protractor Check if Element Does Not Exist(量角器检查元素是否不存在)
                Protractor e2e Tests Login Redirection(Protractor e2e 测试登录重定向)
                Explain about async/ await in Protractor(解释 Protractor 中的 async/await)
                Protractor browser.wait doesn#39;t wait(量角器 browser.wait 不等待)
                How to use Protractor with Angular 2?(如何在 Angular 2 中使用量角器?)
              • <i id='vq3xk'><tr id='vq3xk'><dt id='vq3xk'><q id='vq3xk'><span id='vq3xk'><b id='vq3xk'><form id='vq3xk'><ins id='vq3xk'></ins><ul id='vq3xk'></ul><sub id='vq3xk'></sub></form><legend id='vq3xk'></legend><bdo id='vq3xk'><pre id='vq3xk'><center id='vq3xk'></center></pre></bdo></b><th id='vq3xk'></th></span></q></dt></tr></i><div id='vq3xk'><tfoot id='vq3xk'></tfoot><dl id='vq3xk'><fieldset id='vq3xk'></fieldset></dl></div>
                  <tfoot id='vq3xk'></tfoot>

                    <bdo id='vq3xk'></bdo><ul id='vq3xk'></ul>
                  • <small id='vq3xk'></small><noframes id='vq3xk'>

                          <tbody id='vq3xk'></tbody>
                        1. <legend id='vq3xk'><style id='vq3xk'><dir id='vq3xk'><q id='vq3xk'></q></dir></style></legend>