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

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

    <tfoot id='cajjl'></tfoot>
      <bdo id='cajjl'></bdo><ul id='cajjl'></ul>
    1. <legend id='cajjl'><style id='cajjl'><dir id='cajjl'><q id='cajjl'></q></dir></style></legend>
    2. 在屏幕中心启动 Facebook 分享弹出窗口

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

            <tfoot id='SGYWX'></tfoot>
                <tbody id='SGYWX'></tbody>
                本文介绍了在屏幕中心启动 Facebook 分享弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                The following code works well and launches a facebook popup on the screen, however this popup is not centered.

                <script type="text/javascript">
                function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
                

                <a href="http://www.facebook.com/share.php?u=<full page url to share" onClick="return fbs_click()" target="_blank" title="Share This on Facebook"><img src="images/facebookimage.jpg" alt="facebook share"></a>
                

                Here is the script that centers a popup window:

                    <script type="text/javascript">
                 function MyPopUpWin(url, width, height) {
                    var leftPosition, topPosition;
                    //Allow for borders.
                    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
                    //Allow for title and status bars.
                    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
                    //Open the window.
                    window.open(url, "Window2",
                    "status=no,height=" + height + ",width=" + width + ",resizable=yes,left="
                    + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY="
                    + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
                }
                </script>
                

                Can someone please update the 1st script so that it works in combination with the 2nd script to result in the popup window launching in the center of the screen. (As my experience with coding is very limited i know not how to do this.) Thanks heaps. Pia

                解决方案

                See if this works for you:

                <script type="text/javascript">
                function fbs_click(width, height) {
                    var leftPosition, topPosition;
                    //Allow for borders.
                    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
                    //Allow for title and status bars.
                    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
                    var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
                    u=location.href;
                    t=document.title;
                    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer', windowFeatures);
                    return false;
                }
                </script>
                
                <!-- Please change the width and height to suit your needs -->
                <a href="http://www.facebook.com/share.php?u=<full page url to share" onClick="return fbs_click(400, 300)" target="_blank" title="Share This on Facebook"><img src="images/facebookimage.jpg" alt="facebook share"></a>
                

                这篇关于在屏幕中心启动 Facebook 分享弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:window.open 没有使用 AJAX 和操纵 window.location 的弹出窗口阻止程序 下一篇:在点击位置打开弹窗

                相关文章

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

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