0

我正在使用此代码

<SCRIPT language="JavaScript">
 <!--
 function popup_window(url,w,h)
 {
  var width=w;
  var height=h;
  var from_top=350;
  var from_left=500;
  var toolbar='no';
  var location='no';
  var directories='no';
  var status='no';
  var menubar='no';
  var scrollbars='yes';
  var resizable='yes';
  var atts='width='+width+'show,height='+height+',top='+from_top+',screenY=';
  atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
  atts+=',location='+location+',directories='+directories+',status='+status;
  atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
  window.open(url,'win_name',atts);
 }
 </SCRIPT>


<a href="javascript: popup_window('http://www.facebook.com/sharer/sharer.php?u=http://www.google.com/',300,200)">Click to see a demo popup window</a> 

但是在facebook将弹出窗口调整为默认大小后,我需要强制弹出窗口以我想要的大小加载并保持该大小

有什么办法可以做到这一点吗?

谢谢

4

1 回答 1

0

你需要有一些东西:

function popup_window(url,w,h)
{
    .......
    var popupWin = window.open(url,'win_name',atts);
    popupWin.onload = function(){
       popupWin.document.height = w;
       popupWin.document.width = h;   
    }
}

您需要在弹出窗口中添加该代码。

于 2012-07-17T16:32:57.633 回答