JS 打开、关闭子窗口

来源:互联网 发布:淘宝怎么删除卖家评价 编辑:程序博客网 时间:2024/05/18 01:48

JS 打开、关闭子窗口

var win;function openChildWin(){    var screenX = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,        screenY = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,        outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,         outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),         width = 680,         height = 480,         left = parseInt(screenX + ((outerWidth - width) / 2), 10),         top = parseInt(screenY + ((outerHeight - height) / 2.5), 10),         features = (                'width=' + width +                ',height=' + height +                ',left=' + left +                ',top=' + top);    win = window.open('/login', 'Connect with facebook', features);    if (window.focus) {win.focus();}}function closeChildWin(){    if(win && win.open && !win.closed){        win.close();    }}
0 0
原创粉丝点击