window.open和close

点击触发func在浏览器新开一个窗口,关闭新窗口后还可以控制

function openMyWindow(turnUrl) {
var newWidth=1200; //弹出窗口的宽度;
var newHeight=600; //弹出窗口的高度;
var newTop= (window.screen.availHeight-30-newHeight)/2; //获得窗口的垂直位置;
var newLeft= (window.screen.availWidth-10-newWidth)/2; //获得窗口的水平位置;
var win = window.open(turnUrl,”“,”height=”+newHeight+”, width=”+newWidth+”, top=”+iTop+”, left=”+iLeft);
var timer=setInterval((function(win){return function(){
if(win.closed){ //关闭了打开的新窗口
// window.location.reload();
clearInterval(timer);
}
};})(win),1000);

}

你可能感兴趣的:(JavaScript)