Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help - popup behaviours

Status
Not open for further replies.

howdoesthiswork

Technical User
Sep 24, 2002
18
0
0
NA
Hi there

My problem is the following, I have a page from which I open a popup(this parent page stays open), on the popup are two documents listed from which the user can choose one. When he clicks on one of the document links, the popup closes and opens the document in a new full window.

On the popup
Code:
<a href=&quot;doc1.pdf&quot; onclick=&quot;window.open(this.href, 'child'); return false&quot;>Doc 1</a>

Code:
<a href=&quot;doc2.pdf&quot; onclick=&quot;window.open(this.href, 'child'); return false&quot;>Doc 2</a>

So far it works with the exeption that the popup does not close ... I have tried self.close() but only managed to mess things up further. Any ideas?
 
I use a popup on my pages and to I have a link on the popup page that closes itself. I use:

parent.oPopup.hide()

oPopup is the name of my popup window.
 
Sorry SarkMan, I don't quite understand. How would you make the popup close and the selected document open in its own full window? I am reasonably new to JavaScript and can't (yet) quite wrap my mind around it ...
 
I assume you are creating the popup as follows:
window.createPopup();

then popups should close when they lose focus.
But you can do the following to close the popup

<a href=&quot;doc1.pdf&quot; onclick=&quot;parent.window.open(this.href, 'child'); return false;parent.oPopup.hide()&quot;>Doc 1</a>
 
I am opening the popup with

Code:
  function agb(){
window.open(&quot;popup.htm&quot;, &quot;popup&quot;, &quot;height=150, width=400, top=150, left=250&quot;)

if I then say ..

Code:
<a href=&quot;doc1.pdf&quot; onclick=&quot;parent.window.open(this.href, 'child'); return false;parent.popup.hide()&quot;>Doc 1</a>

.. it works as previously, and the popup still stays open.
When I use window.createPopup() I get a runtime error in my browser ...
 
I guess I misunderstood you. I thought you were creating a popup window using the createpopup method.

try this on the popup window


<a href=&quot;70-315.pdf&quot; onclick=&quot;window.open(this.href, 'child'); self.close();return false&quot;>Doc 1</a>

 
Super, thanx a million, it works as I wanted it to. The help is much appreciated ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top