page not loading in open pop up

A

anag

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:eek:pen_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=yes');

if
(parseFloat(navigator.appVersion.substring(0,navigator.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
 
K

kaeli

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,

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
 
A

anag

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.
 
K

kaeli

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.

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?

--
 
A

anag

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

Thanks for all your help.
Ana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,757
Messages
2,569,543
Members
45,026
Latest member
camilin05

Latest Threads

Top