By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,715 Members | 1,256 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,715 IT Pros & Developers. It's quick & easy.

page not loading in open pop up

P: n/a
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

Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <11**********************@o13g2000cwo.googlegroups .com>,
an*******@yahoo.com enlightened us with...
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

Jul 23 '05 #2

P: n/a
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:
In article <11**********************@o13g2000cwo.googlegroups .com>,
an*******@yahoo.com enlightened us with...
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


Jul 23 '05 #3

P: n/a
In article <11**********************@f14g2000cwb.googlegroups .com>,
an*******@yahoo.com enlightened us with...
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?

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

Jul 23 '05 #4

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

Thanks for all your help.
Ana

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.