PDA

View Full Version : Need a code to check for an open window


Dinglo
12-03-2003, 09:42 PM
Basically I have a button that calls up a javascript popup window. I want to be able to swap out the contents of that window with other html pages. So I need a code to check to see if the window is open before i replace the contents and if it is not open to create it with the javascript methods. I've figured out the If and Else statements but I don't know how to write the code to see if my target is available (window is open). Please Help. Thanks.

freddycodes
12-03-2003, 09:48 PM
Well you should have named your window right?


window.open('blahblah', 'winName', 'features');



To check it in javascript it would be


if(winName != null && !winName.closed)
{
winName.location.href = 'someurl.htm';
}
else
{
window.open('blahblah', 'winName', 'features');
}