- var openWindow = function(url, options) {
- var str = "";
- if (options) {
- options.height = options.height || 420;
- options.width = options.width || 550;
- options.left = options.left || ((screen.width - options.width) / 2); // 默认为居中
- options.top = options.top || ((screen.height - options.height) / 2); // 默认为居中
- for (var i in options) {
- str += ',' + i + '=' + options[i];
- }
- str = str.substr(1);
- };
- window.open(url, 'connectwindow'+ (+new Date), str);// 参数 1 为 url, 参数 2 为了能可以重复弹出
- str = null;
- };
来源: http://www.qdfuns.com/article/31062/9a64b59d7950db8dad47dbdc4fe4c648.html