这里列举了四个设置弹出方式
参数都是可写死的,我这里只是简单的统一了一下,方便日后直接调用,有需要的朋友可以复制下来看看、、、、
pageUrl:弹出的路径
target:以什么弹出方式弹出
WinWidth:弹出框的宽度
WinHeight:弹出框的长度
scrollbars:是否有滚动条
resizable:是否可自设置弹出框大小
WinOpenImage()这个是弹出图片的js
function WinOpen(pageUrl, target, WinWidth, WinHeight) {
var popwin = window.open(pageUrl, target, "scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=" + WinWidth + ",height=" + WinHeight + ",left=" + (screen.width - WinWidth) / 2 + ",top=" + (screen.height - WinHeight - 100) / 2);
popwin.focus();
return false;
}
function WinOpen2(pageUrl, target, WinWidth, WinHeight, scrollbars) {
var popwin = window.open(pageUrl, target, "scrollbars=" + scrollbars + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=" + WinWidth + ",height=" + WinHeight + ",left=" + (screen.width - WinWidth) / 2 + ",top=" + (screen.height - WinHeight - 100) / 2);
popwin.focus();
return false;
}
function WinOpen3(pageUrl, target, WinWidth, WinHeight, scrollbars, resizable) {
if (resizable == null) resizable = "no";
var popwin = window.open(pageUrl, target, "scrollbars=" + scrollbars + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=" + resizable + ",width=" + WinWidth + ",height=" + WinHeight + ",left=" + (screen.width - WinWidth) / 2 + ",top=" + (screen.height - WinHeight - 100) / 2);
popwin.focus();
return false;
}
function WinOpenImage(pageUrl, target, WinWidth, WinHeight) {
var popwin = window.open(pageUrl, target, "scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width=" + WinWidth + ",height=" + WinHeight + ",left=" + (screen.width - WinWidth) / 2 + ",top=0");
popwin.focus();
return false;
}