• <legend id='0f1Mh'><style id='0f1Mh'><dir id='0f1Mh'><q id='0f1Mh'></q></dir></style></legend>

      <tfoot id='0f1Mh'></tfoot>

      <small id='0f1Mh'></small><noframes id='0f1Mh'>

          <bdo id='0f1Mh'></bdo><ul id='0f1Mh'></ul>

      1. <i id='0f1Mh'><tr id='0f1Mh'><dt id='0f1Mh'><q id='0f1Mh'><span id='0f1Mh'><b id='0f1Mh'><form id='0f1Mh'><ins id='0f1Mh'></ins><ul id='0f1Mh'></ul><sub id='0f1Mh'></sub></form><legend id='0f1Mh'></legend><bdo id='0f1Mh'><pre id='0f1Mh'><center id='0f1Mh'></center></pre></bdo></b><th id='0f1Mh'></th></span></q></dt></tr></i><div id='0f1Mh'><tfoot id='0f1Mh'></tfoot><dl id='0f1Mh'><fieldset id='0f1Mh'></fieldset></dl></div>
      2. 弹出窗口以在关闭时将数据返回给父级

        时间:2023-10-01
        <tfoot id='mymm2'></tfoot>
      3. <i id='mymm2'><tr id='mymm2'><dt id='mymm2'><q id='mymm2'><span id='mymm2'><b id='mymm2'><form id='mymm2'><ins id='mymm2'></ins><ul id='mymm2'></ul><sub id='mymm2'></sub></form><legend id='mymm2'></legend><bdo id='mymm2'><pre id='mymm2'><center id='mymm2'></center></pre></bdo></b><th id='mymm2'></th></span></q></dt></tr></i><div id='mymm2'><tfoot id='mymm2'></tfoot><dl id='mymm2'><fieldset id='mymm2'></fieldset></dl></div>
            <bdo id='mymm2'></bdo><ul id='mymm2'></ul>
          • <legend id='mymm2'><style id='mymm2'><dir id='mymm2'><q id='mymm2'></q></dir></style></legend>

                <tbody id='mymm2'></tbody>

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

                1. 本文介绍了弹出窗口以在关闭时将数据返回给父级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用 window.open() 打开了一个弹出窗口.我现在想要的是让用户能够点击这个新窗口中的 2 个链接之一:允许"或不允许".

                  I've got a popup window opened using window.open(). What I want now is for a user to be able to click one of 2 links within this new window: "Allow" or "Don't Allow".

                  当用户单击其中一个链接时,弹出"窗口应该关闭,并返回允许"或不允许"或类似的内容,true/false 会做,到父窗口.

                  When a user clicks one of those links the 'popup' window should close, and return either "allow" or "don't allow" or something along those lines, true/false would do, to the parent window.

                  有可能吗?如果有,怎么做?

                  Is it possible? If so, how?

                  代码:

                  var authWindow = window.open('auth.php', 'authWindow', 'options...');
                  

                  那么auth.php里面只有2个锚点?

                  Then just 2 anchors inside auth.php?

                  推荐答案

                  在调用(父)窗口中添加这样的JS代码:

                  In the calling (parent) window add such JS code:

                  function HandlePopupResult(result) {
                      alert("result of popup is: " + result);
                  }
                  

                  在子窗口代码中添加:

                  function CloseMySelf(sender) {
                      try {
                          window.opener.HandlePopupResult(sender.getAttribute("result"));
                      }
                      catch (err) {}
                      window.close();
                      return false;
                  }
                  

                  并且有这样的链接可以关闭弹窗:

                  And have such links to close the popup:

                  <a href="#" result="allow" onclick="return CloseMySelf(this);">Allow</a>
                  <a href="#" result="disallow" onclick="return CloseMySelf(this);">Don't Allow</a>
                  

                  这篇关于弹出窗口以在关闭时将数据返回给父级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用数据 URI 的 Base64 编码 OpenType 字体 下一篇:使用 CSS 进行背景模糊

                  相关文章

                2. <small id='dMxO4'></small><noframes id='dMxO4'>

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

                    • <bdo id='dMxO4'></bdo><ul id='dMxO4'></ul>

                      <tfoot id='dMxO4'></tfoot>

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