forked from limingziqiang/functions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openWindow.js
25 lines (24 loc) · 898 Bytes
/
openWindow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @description 打开一个窗体通用方法
* @author 未知
*/
function openWindow(url,windowName,width,height){
var x = parseInt(screen.width / 2.0) - (width / 2.0);
var y = parseInt(screen.height / 2.0) - (height / 2.0);
var isMSIE= (navigator.appName == "Microsoft Internet Explorer");
if (isMSIE) {
var p = "resizable=1,location=no,scrollbars=no,width=";
p = p+width;
p = p+",height=";
p = p+height;
p = p+",left=";
p = p+x;
p = p+",top=";
p = p+y;
retval = window.open(url, windowName, p);
} else {
var win = window.open(url, "ZyiisPopup", "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,modal=yes,width=" + width + ",height=" + height + ",resizable=no" );
eval("try { win.resizeTo(width, height); } catch(e) { }");
win.focus();
}
}