如何查看具有特定名称的窗口是否已关闭?

时间:2010-12-04 19:44:00

标签: javascript html javascript-events

一般来说,我的问题是如何找到一个已关闭的窗口数组?

我打开了很多popUp窗口,让tham保持在最顶层。但我发现窗口是否已经关闭有问题。所以我做了类似的事情:

var exNames = []; var wins = []; var w=0; var h=0; var maxHeight = 0;

openWin = function(name, width, height){
 var myJoin = "|" + exNames.join("|") + "|";
if(myJoin.indexOf('|'+name+'|') == -1){

    if(height > maxHeight){ maxHeight = height + 5;}
    if(screen.width - w - width < 0){w=0;  h=h+maxHeight; top=h+1; maxHeight=0; if(screen.height - h - height < 0){h=0;} } 

    left=w+1;
    tops=h+1;
    w=w+width+7;

    var file='./'+name+'.flv?action=read';
    var settings='width='+width+', height='+height+', left='+left+', top='+tops+', screenX='+left+', screenY='+tops;
     wins.push(window.open(file, name, settings));
         exNames.push(name);


}          for (var i = 0; i < wins.length; ++i)
            wins[i].focus();
}

我需要知道有人发给我一个窗口的名称,该窗口已经打开并关闭以恢复该窗口。怎么做这个?

1 个答案:

答案 0 :(得分:1)