我正在使用此代码
<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将弹出窗口调整为默认大小后,我需要强制弹出窗口加载我想要的大小并保持该大小
我有什么方法可以做到这一点吗?
谢谢
答案 0 :(得分: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;
}
}
您需要在弹出窗口中添加该代码。