Click to See Complete Forum and Search --> : Popup windows and parent reset


askohen
06-19-2003, 08:47 AM
Hi. I just started to play around with Javascript and am stumped. I have a parent page with a link that activates a popup window; however, after the child window opens, the parent window resets and moves to the top of the page.

I would like the parent window to stay where it was, so the user can return to the same spot that he/she clicked in the first place. How do I do this? Thanks.

Khalid Ali
06-19-2003, 08:53 AM
Looks like there is some sort of "error" in your code thats causing this...post the code here

askohen
06-19-2003, 09:00 AM
Thanks. It's funny, though, Netscape or IE aren't throwing errors. Perhaps the problem is that I used # as the href. Maybe that is not the proper way...?

<p onClick="MM_openBrWindow('ip.html','ip','scrollbars=yes,width=600,height=700')"><A href="#">View a listing of the 2003-2004 Intellectual Property Concentration Classes. </A></p>

Khalid Ali
06-19-2003, 09:24 AM
yes actually thats exactly what is causing your page reload.in HTML it reloads the page....or at least goes to the top in absense of an internal href...

anyways...the quickes work around will
this

<a href="#" onclick="return false;">

Charles
06-19-2003, 09:28 AM
But if you want something that will also work for the 13% of users that do not use JavaScript then try:

<p><a href="ip.html" onclick="winbdow.open(this.href, 'ip','scrollbars,width=600,height=700'); return false">View a listing of the 2003-2004 Intellectual Property Concentration Classes. </A></p>

Charles
06-19-2003, 09:35 AM
Originally posted by requestcode
Charles - you are still using javascript in the link. True, but I'm not relying on it. On any JavaScript free browser or any browser with pop-ups disabled the link will still work.

khaki
06-19-2003, 09:39 AM
that's funny.

requestcode edited himself completely out of the thread...
and now he makes you look like you are talking to yourself, Charles :)

i hate when people do that
;) k

askohen
06-19-2003, 10:32 AM
Thanks for your help.

askohen
06-19-2003, 11:38 AM
Can anyone please explain what the "return false" does?

Charles
06-19-2003, 12:28 PM
Originally posted by askohen
Can anyone please explain what the "return false" does? It supresses the natural behavior of the A element.