我正在使用window.open从javascript打开一个弹出窗口。我想打开页面右上角的弹出窗口(height =“700px”width =“400px”)。我怎样才能实现这个目标
答案 0 :(得分:2)
您可以将以下方法称为:
popUpAtMyWish("yourpage","windownamehere",500,600);
function popUpAtMyWish( pageToLoad, winName, width, height)
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 )){
xposition = (screen.width - width);
yposition = (screen.height - height);
}
var args = "";
args += "width=" + width + "," + "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=0,"
+ "statusbar=false,dependent,alwaysraised,"
+ "status=false,"
+ "titlebar=no,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //NN Only
+ "screeny=" + yposition + "," //NN Only
+ "left=" + xposition + "," //IE Only
+ "top=" + yposition; //IE Only
var dmcaWin = window.open(pageToLoad,winName,args );
dmcaWin.focus();
}