<bdo id='uFU07'></bdo><ul id='uFU07'></ul>
    1. <tfoot id='uFU07'></tfoot>

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

      <legend id='uFU07'><style id='uFU07'><dir id='uFU07'><q id='uFU07'></q></dir></style></legend>

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

      1. 在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?

        In Google Chrome, how do I bring an existing popup window to the front using javascript from the parent window?(在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?)

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

          <tbody id='K3os1'></tbody>
          <bdo id='K3os1'></bdo><ul id='K3os1'></ul>

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

                  本文介绍了在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在网页上有一个具有以下行为的按钮:

                  I would like to have a button on a web page with the following behavior:

                  • 第一次点击时,打开一个弹出窗口.
                  • 在以后的点击中,如果弹出窗口仍然打开,只需将其带到前面即可.如果没有,请重新打开.

                  以下代码适用于 Firefox(Mac 和 Windows)、Safari(Mac 和 Windows)和 IE8.(我还没有测试过 IE6 或 IE7.)但是,在 Google Chrome(Mac 和 Windows)中,稍后单击无法将现有的弹出窗口按需要置于最前面.

                  The below code works in Firefox (Mac & Windows), Safari (Mac & Windows), and IE8. (I have not yet tested IE6 or IE7.) However, in Google Chrome (both Mac & Windows) later clicks fail to bring the existing pop-up to the front as desired.

                  如何在 Chrome 中进行这项工作?

                  How can I make this work in Chrome?

                  <head>
                    <script type="text/javascript">
                      var popupWindow = null;
                      var doPopup = function () {
                        if (popupWindow && !popupWindow.closed) {
                          popupWindow.focus();
                        } else {
                          popupWindow = window.open("http://google.com", "_blank",
                            "width=200,height=200");
                        }
                      };
                    </script>
                  </head>
                  
                  <body>
                    <button onclick="doPopup(); return false">
                      create a pop-up
                    </button>
                  </body>
                  

                  背景:我正在重新询问 this question 专门针对 Google Chrome,因为我认为我的代码至少解决了其他现代浏览器和 IE8 的问题.如果有这样做的首选礼仪,请告诉我.

                  Background: I am re-asking this question specifically for Google Chrome, as I think I my code solves the problem at least for other modern browsers and IE8. If there is a preferred etiquette for doing so, please let me know.

                  推荐答案

                  你不能.出于安全原因,Chrome 中禁用了 Window.focus,这不太可能改变.

                  You can't. Window.focus is disabled in Chrome for security reasons, and that is unlikely to change.

                  您必须关闭并重新打开相应的窗口.

                  You have to close and repopen the respective window.

                  这篇关于在 Google Chrome 中,如何使用父窗口中的 javascript 将现有的弹出窗口置于最前面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                • <tfoot id='yk83J'></tfoot>
                    <tbody id='yk83J'></tbody>

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

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