How to find out if window with certain name was closed?
Generally my question is how to find in array of windows which one was closed?
I open lots of popUp windows and make them stay on top, but I have a problem with finding if window was closed already. So I do something like:
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 - 开发者_如何学Gowidth < 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();
}
And I need to know when someone sends me name of a window which was already opened and closed to restore that window. How to do such thing?
how about using the window.closed
property http://www.devguru.com/technologies/ecmascript/quickref/win_closed.html
精彩评论