Connecting Tech Pros Worldwide Forums | Help | Site Map

page not loading in open pop up

anag
Guest
 
Posts: n/a
#1: Jul 23 '05
I am opening pop up windows from a hint button on several pages in my
site. If the user leaves the pop up window open from a previous page, I
would like the new hint to open in that window.

I thought that by giving the pop-ups the same name it should work (see
code below) but it isnt. Every time a user clicks on the hint button
the popup opens in a new window regardless of the fact that a previous
hint window is open .

here is my code that calls the function from an html page (there is
also some rollover code in it):

<a href="javascript:open_pop_hint('ex3_n2_hint.html', 'hint');"
onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('Image43','','../images/button_hint_on.gif',1)">

And here is the function that is called from an external javascript
file.

//open hint popup
function open_pop_hint(path, targ)
{
litwin = window.open(path,
targ,'width=520,height=200,toolbar=no,location=no, status=yes,menubar=yes,scrollbars=yes,resizable=ye s');

if
(parseFloat(navigator.appVersion.substring(0,navig ator.appVersion.indexOf("
")))>=3.0)
{
litwin.focus();
}
}

Any help would be greatly appreciated I keep staring at the code and I
dont see where the problem is and I cant find anything on the web about
it. Everything seems to be about how this should work.

PS. the most baffling thing of all is that I used this same code on an
old site and it worked as expected.

thanks in advance

kaeli
Guest
 
Posts: n/a
#2: Jul 23 '05

re: page not loading in open pop up


In article <1109610578.188806.159920@o13g2000cwo.googlegroups .com>,
anagirone@yahoo.com enlightened us with...[color=blue]
> I am opening pop up windows from a hint button on several pages in my
> site. If the user leaves the pop up window open from a previous page,[/color]

There's your problem. From a PREVIOUS page. That means all variables are
lost.
Unless you use a frameset (and hold the variables in global scope of a page
that doesn't change), you can't do this. A frameset has way too many cons to
use it just for something like this.

--
--
~kaeli~
Any sufficiently advanced technology is indistinguishable
from magic.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

anag
Guest
 
Posts: n/a
#3: Jul 23 '05

re: page not loading in open pop up


Thank you for replying so promptly, I really appreciate your taking the
time to help me.

The only thing about the mystery is that I just checked my old website
that uses the exact same code and it doesnt need frames for the html
page to continue to open in a pop up that was opened with the same
name. Even if you are on a different page? I'm looking at it in IE5 on
both a PC and a Mac.

kaeli wrote:[color=blue]
> In article <1109610578.188806.159920@o13g2000cwo.googlegroups .com>,
> anagirone@yahoo.com enlightened us with...[color=green]
> > I am opening pop up windows from a hint button on several pages in[/color][/color]
my[color=blue][color=green]
> > site. If the user leaves the pop up window open from a previous[/color][/color]
page,[color=blue]
>
> There's your problem. From a PREVIOUS page. That means all variables[/color]
are[color=blue]
> lost.
> Unless you use a frameset (and hold the variables in global scope of[/color]
a page[color=blue]
> that doesn't change), you can't do this. A frameset has way too many[/color]
cons to[color=blue]
> use it just for something like this.
>
> --
> --
> ~kaeli~
> Any sufficiently advanced technology is indistinguishable
> from magic.
> http://www.ipwebdesign.net/wildAtHeart
> http://www.ipwebdesign.net/kaelisSpace[/color]

kaeli
Guest
 
Posts: n/a
#4: Jul 23 '05

re: page not loading in open pop up


In article <1109618311.468200.159940@f14g2000cwb.googlegroups .com>,
anagirone@yahoo.com enlightened us with...[color=blue]
> Thank you for replying so promptly, I really appreciate your taking the
> time to help me.
>
> The only thing about the mystery is that I just checked my old website
> that uses the exact same code and it doesnt need frames for the html
> page to continue to open in a pop up that was opened with the same
> name. Even if you are on a different page? I'm looking at it in IE5 on
> both a PC and a Mac.
>[/color]

IE5 was buggy and allowed a lot of things other browsers didn't/don't allow.

Did you try with IE6 WinXP SP2? If not, post the URL and I'll take a look at
it when I get home.

That was the only idea I had, anyway.

I have one more idea...
The variable you use to define the window -- you DID remember to make it
global, right?

function open_pop_hint(path, targ)
{
litwin = window.open(path, ...

You need to have a
var litwin = null;
BEFORE (not inside) the function. Otherwise the variable is local to the
function.

Did that help any?

--
--
~kaeli~
Time flies like an arrow. Fruit flies like a banana.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

anag
Guest
 
Posts: n/a
#5: Jul 23 '05

re: page not loading in open pop up


thank you so much I had a mis-spelling in the global variable! and now
it works.

Thanks for all your help.
Ana

Closed Thread