SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    Also available in Large Si's Avatar
    Join Date
    Sep 2002
    Location
    Walsall, UK
    Posts
    1,911
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Controlling popup window

    I'm trying to control a popup window from two different pages in my main window but having troubles.

    My first page (bigpage1.asp) opens a popup window called 'PopCreate'. This popup window opens a frameset with two frames; 'TopFrame' and 'BottomFrame'. While 'BottomFrame' is processing some information, the top frame's page (top1.asp) refreshes to page 2 (top2.asp) after 3 seconds (using meta refresh). On page 2 (top2.asp), I want the entire popup window to close. I'm having troubles with this.

    Alternatively, when the first page (bigpage1.asp) in my main window refreshes to the main second page (bigpage2.asp), the second page (bigpage2.asp) could close the popup window (PopCreate).

    Any ideas how I might do this? If you still don't understand, please shout!!

    Cheers

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's a demo I just cooked up for you...
    I'll leave you to work out how to tweak it for your needs (otherwise it's no fun!)

    testpopup.htm:
    Code:
    <html>
    <script language="JavaScript">
    var myWindow = null;
    
    function openpopup()
    {
    	myWindow = window.open('popup.htm');
    }
    
    function closepopup()
    {
    	if (myWindow!=null)
    	{
    		myWindow.close()
    		myWindow=null;
    	}
    }
    </script>
    <body>
    <input type="button" value="test" onclick="openpopup()" />
    </body>
    </html>
    popup.htm:
    Code:
    <html>
    <body onload="alert('click ok to close window'); window.opener.closepopup();">
    </body>
    </html>
    Any questions?

    (Alternatively, if an IE-only solution is ok, then simply use a modal dialog which closes itself when processing is complete...!)
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  3. #3
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So was that of any use then?
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •