次のコードはうまく機能し、画面上にFacebookポップアップを起動しますが、このポップアップは中央に配置されていません。
<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>
ポップアップウィンドウを中央に配置するスクリプトは次のとおりです。
<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>
誰かが1番目のスクリプトを更新して、2番目のスクリプトと組み合わせて動作し、画面の中央でポップアップウィンドウが起動するようにしてください。(コーディングの経験は非常に限られているので、これを行う方法がわかりません。)ヒープに感謝します。ピア