I have read some posts here but I have not found an answer to my problem. My task is to find a window, if it exists, set focus to it; if it doesn't exists, open a new window. The problem of the following code is, if the window object has never been created and I tried to find it, I got an error (object undefined). (It is working fine after childWindow is created and closed.) How can I get around this? thanks.
================================
function findOrOpenWindow(){
if (childWindow && !childWindow.closed){
alert('ChildWindow is found.');
childWindow.focus();
}
else {
childWindow = window.open(' }
}
================================
function findOrOpenWindow(){
if (childWindow && !childWindow.closed){
alert('ChildWindow is found.');
childWindow.focus();
}
else {
childWindow = window.open(' }
}