Click to See Complete Forum and Search --> : My page stops loading when a popup window is launched. :(


jammer20002
09-21-2003, 04:43 PM
I have a webpage that has a table of lots of small pictures on.
The small pictures have javascript popup link behind them.

Now the problem is that if I click on one of the small pictures to launch a popup window, then the original window stops loading.

How can I stop this??
I've just had a look at other very popular websites.
They seem to suffer from the same problem.

There MUST be a way round this problem?

Any help would be appreciated.

Thanks.


Jam

Charles
09-21-2003, 05:04 PM
Make sure that you are using something like the following to open you child window...

<a href="http://www.w3.org/" onclick="window.open(this.href, 'child', 'height=400,width=300'); return false">W3C</a>

jammer20002
09-21-2003, 05:16 PM
The problem is that I have a function call and not the inline function you have in your coce.

I've tried adding return false after calling the function...
BUT... I then get an error saying that I'm not allowed to call a return outside of a function.

When I put the return false inside of the function at the end...
Then after the click... it just takes me to a page that says 'false'. :)

What else can i do to get round it? :(

Thanks.

pyro
09-21-2003, 05:30 PM
Post your code for us to look at.

jammer20002
09-21-2003, 06:01 PM
Thanks for the reply.
I've managed to solve the problem (with the help of a few rplies from another posting).

I had:

href="javascript:launchWindowFunction();"

I was told that the above cause the parent window to stop.

Instead I have had to do the following:

href="#" onClick="javascript:launchWindowFunction();return false"

That seems to have solved the problem. :)

Just out of interest... can you tell me what the 'return false' does?

Thanks.

pyro
09-21-2003, 06:20 PM
Yes. return false tells it not to run the original link (in your case, the anchor to nohwere -- the #). Otherwise, it will run your function and also jump the page to the top (as that is what a # in the href does).

On a side note, you don't need javascript: in the onclick, this would be fine:

<a href="#" onClick="launchWindowFunction(); return false;">