Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create/focus popup via href link

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi folks;
I'm at the "know just enough to be dangerous" level.
I am trying to pop up window from a link.
If the window not exist, create and load, if exist, focus.

I seem to be running into a problem with the glosswin.closed property in the code below.
I am not sure what value to look for to tell me if the window is present or not.

If I substitute 1==1 in the eval statement, it seems to work fine.

<a href=javascript:if((glosswin.closed)==(null))void(glosswin=window.open('
Any glaring blunders?

Thanks

Dave
 
The closed attribute returns boolean, so perhaps that is what is going on. Just remove the == null bit. &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer&quot;
 
Thanks,
That looked reasonable to me too, I tried
if(glosswin.closed==0)
if(glosswin.closed!=0)
if(glosswin.closed==1)
if(glosswin.closed!=1)
if(glosswin.closed==('false') (which is what is returned if I document.write it)
etc.

But with any of those, neither side of the if/else executes.
Doesn't matter if the glosswin window hs been created or not.
Is there another property I can use in this string to query the existence of a window?

Thanks

Dave
 
for the record:

the !window.glosswin accounts for an uninitialized (or undeclared) value of glosswin. (or any variable)
The code below works.
The dummy=&quot;&quot; statement is because if I follow the else directly with the for, it errors for some reason.

<a href=javascript:if(!window.glosswin||glosswin.closed)void(glosswin=window.open('
Thanks

Dave
 
Just as an aside, too. if you call open(), with no parameters, and no specified URL - you obtain a reference to an existing window.

What is the void for? I have never found out what that operator does. BB &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top