目前没控制窗口位置,可以通过win.moveTo(x,y)!
/**/
/*
* 打开窗口或Dialog
* @param String url URL地址
* @param Boolean bScrollbar 是否需要滚动条
* @param Number w 窗口宽度
* @param Number h 窗口高度
* @param Boolean dialog 是否Module窗口
* @param string target 目标 _blank、self、....
*/
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
function
show(url,bScrollbar,w,h,bDialog,target)
...
{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if ('undefined'==typeof(url)) ...{
return;
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if ('number'!=typeof(w)) ...{
w = window.screen.availWidth;
}
var bFull = false;
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if ('number'!=typeof(h)) ...{
h = window.screen.availHeight - 30;
bFull = true;
}
var params;
var win = null;
var l = (window.screen.availWidth - w) / 2;
var t = (window.screen.availHeight -h) / 2 - (bFull ? 15 : 0);
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if (bDialog) ...{
params = "dialogLeft:" + l + ";dialogTop:" + t + ";status:no;dialogWidth:" + w + "px;dialogHeight:" + h + "px;help:no;resizable:no;";
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if ('object'!=typeof(target)) ...{
target = window;
}
win = window.showModalDialog(url,targer,params);
}
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
else ...{
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if('boolean'!=typeof(bScrollbar)) ...{
bScrollbar = true;
}
params = "toolbar=0,titlebar=0,menubar=0,resizable=0,Height=" + h + "px,Width=" + w + "px,status=0,top=" + t + ",left=" + l + ",scrollbars=" + (bScrollbar ? "1" :"0");
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
if ('string'!=typeof(target)) ...{
target = "";
}
win = window.open(url,targer,params);
if(!win||(win.closed||!win.focus) || typeof(win.document)=='unknown' || typeof(win.document)=='undefined')
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
alert("您的计算机安装了弹出式窗口拦截器,如百度工具条、新浪工具条等,导致无法打开新窗口,请关闭拦截功能后重新进入系统,以便打开新窗口。")
return false;
}
}
return win;
}