function OpenPopupWindow(strOpen, width, height)
{
window.showModalDialog(strOpen, this, 'dialogHeight:'+height+'px;dialogWidth:'+width+'px;Status:no;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
}
////////////////////////////////////////////////////////////
function openwindow(url,width,height)
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
{
xposition = (screen.width - width) / 2;
yposition = (screen.height - height-50) / 2;
}
theproperty= "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=0,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + ","
+ "screeny=" + yposition + ","
+ "left=" + xposition + "," //IE
+ "top=" + yposition; //IE
var win=window.open(url,"",theproperty);
win.moveTo(xposition,0);
}
本文介绍两种在网页中打开新窗口的方法:一种用于显示模态弹窗,另一种用于打开自定义尺寸的新浏览器窗口,并详细展示了两种方法的JavaScript实现。

被折叠的 条评论
为什么被折叠?



