window.open(‘httP://codeo.cn/‘, ‘newwindow‘, ‘height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no‘)
各参数详解
1 function openWin(url, name, iWidth, iHeight) { 2 //获得窗口的垂直位置 3 var iTop = (window.screen.availHeight - 30 - iHeight) / 2; 4 //获得窗口的水平位置 5 var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; 6 window.open(url, name, ‘height=‘ + iHeight + ‘,innerHeight=‘ + iHeight + ‘,width=‘ + iWidth + ‘,innerWidth=‘ + iWidth + ‘,top=‘ + iTop + ‘,left=‘ + iLeft + ‘,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no‘); 7 }
在新打开页面中执行代码:
window.opener = null; window.open(‘‘, ‘_self‘); window.close();
新窗口中关闭代码如下:
<input type="button" onclick="window.opener = null; window.open(‘‘, ‘_self‘); window.close();" value="关闭" />
原文:http://www.cnblogs.com/lmaster/p/6369932.html