Click to See Complete Forum and Search --> : Window - does it exist?


Webskater
06-23-2003, 06:45 AM
Can anyone tell me how to check if a window called 'Fred' already exists? Thanks.

Webskater
06-23-2003, 07:19 AM
Thanks for your answer Dave - unfortunately I appear to be too thick to understand it.

Is this saying...

If the document that is loaded into this new window does not have the code

myObject = new Object();
myObject.name = "myObject";

in the head of the document then - close the window. If it does have the code then move the focus to the window. If this is the case - can you explain how is it checking to see if the window object called 'Fred' is already open? Thanks again.

Webskater
06-23-2003, 08:47 AM
I'll try to make what I am doing clearer. I have an application which uses lots of pop-up windows (its a business application and people want to be able to do more than one task at once). So, if while they are working on an estimate, they want to open a customer window, I need to check that they haven't already got a window open with the 'find customer' page in it. I figure that, if every time I open the 'find customer' page it is opened using .. window.open('',fred,200,300) .. then all I have to do is check if such a window object exists before opening it again.
I am under the impression that your code opens a new window, checks to see if the document it contains itself contains a certain object and then either closes it or puts the focus on it. I know I must be missing something here but how does this check if there is already a window open with a document containing 'myObject'?
Thanks for your help.

Webskater
06-23-2003, 09:49 AM
Again - thanks for help but I have (at last after several previous failed and abandoned attempts) managed to reference the window object so that other windows can tell if it is open or not. Now I can get on with writing an application without modal windows!