pygmalion3
Technical User
I've been trying to create a javascript function that goes through a series of conditionals to check for specific open windows, and, provided they're there, re-focus them.
Here's part of the script I'm using:
function recallPopUps(){
if ( (! (typeof firstWin == "undeclared"
) && ( ! firstWin.closed ) ) {
firstWin.focus()
}
if ( (! (typeof secondWin == "undeclared"
) && ( ! secondWin.closed ) ) {
secondWin.focus()
}
if ( (! (typeof thridWin == "undeclared"
) && ( ! thirdWin.closed ) ) {
thirdWin.focus()
}
if ( (! (typeof fourthWin == "undeclared"
) && ( ! fourthWin.closed ) ) {
fourthWin.focus()
}
}
The problem I'm having is if firstWin is not open, thus undefined, I get a "firstWin Undefined" error, and the script halts right there, not checing the other conditionals. However, if firstWin IS open, it'll go right on to the next conditional where it does the same thing. If ALL windows are open, it works great, but what am I doing wrong to a) get an undefined error and b) not getting the script to check each conditional regardless of if the one prior is true.
Little help?
Here's part of the script I'm using:
function recallPopUps(){
if ( (! (typeof firstWin == "undeclared"

firstWin.focus()
}
if ( (! (typeof secondWin == "undeclared"

secondWin.focus()
}
if ( (! (typeof thridWin == "undeclared"

thirdWin.focus()
}
if ( (! (typeof fourthWin == "undeclared"

fourthWin.focus()
}
}
The problem I'm having is if firstWin is not open, thus undefined, I get a "firstWin Undefined" error, and the script halts right there, not checing the other conditionals. However, if firstWin IS open, it'll go right on to the next conditional where it does the same thing. If ALL windows are open, it works great, but what am I doing wrong to a) get an undefined error and b) not getting the script to check each conditional regardless of if the one prior is true.
Little help?