Results 1 to 8 of 8

Thread: Close popup

  1. #1

    Close popup

    Hi, i need to close a popup window form the opener window, not form the popup itself.

    Any ideas on how to do this?

    I used the following lines to create the popup:

    PHP Code:
    window.open("pop_creating.html""popcreate""width=250,height=20,left=450,top=250"); 
    Thanks

    Powi

  2. #2
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4,342
    window.close(); on the pop-ip..

    if you want to close it from main...

    mywin = window.open();
    mywin.close();

    Peace,
    Testing 1.. Testing 1..2.. Testing 1..2..3...

  3. #3
    Thanks for your answer, but i still have a problem.

    The main window (the one that opened the popup) changed (when i created the popup i also linked to another page), so i lost var mywin. Is there any way to close that window now?

    Thanks again.

    Powi

  4. #4
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4,342
    I dont think so...

    the mother died, no unless it gives the child away to foster care to the new mother (which I dont have any idea howto), its not possible..

    I dont know how..

    sorry

    Peace,
    Testing 1.. Testing 1..2.. Testing 1..2..3...

  5. #5
    Join Date
    Jul 2002
    Location
    The Big Easy -New Orleans
    Posts
    341
    On the new page send the popup window to another page that has window.close() in the onload(). But you have to send it to the same target window.

    Add something like this to the new page:
    window.open("pop_close.html", "popcreate", "width=250,height=20,left=450,top=250");

    Provided you don't have multiple windows called "popcreate" it should work. And if there's no onunload in the pop_creating.html page.


    then in pop_close.html add:
    window.close();
    Last edited by Lagniappe-labgeek; 05-06-2005 at 11:08 AM.

  6. #6
    Join Date
    Jul 2002
    Location
    The Big Easy -New Orleans
    Posts
    341
    here's a link to an example...
    http://www.lapazsoftware.com/testpopup/

    On the first page it opens a popup. When you click "Next Page" that page will redirect the popup window to a new page that will close it...

    index.html
    PHP Code:
    <HTML>
    <
    HEAD>
    <
    TITLE></TITLE>
    </
    HEAD>
    <
    BODY onLoad="window.open('pop_creating.html', 'popcreate', 'width=250,height=20,left=450,top=250');">
    <
    A href="nextpage.html">Next Page</A>
    </
    BODY>
    </
    HTML
    nextpage.html:
    PHP Code:
    <HTML>
    <
    HEAD>
    </
    HEAD>
    <
    BODY onLoad="window.open('pop_close.html', 'popcreate', 'width=250,height=20,left=450,top=250');">
    </
    BODY>
    </
    HTML
    pop_close.html
    PHP Code:
    <HTML>
    <
    HEAD>
    </
    HEAD>
    <
    BODY onLoad="window.close()">
    </
    BODY>
    </
    HTML
    pop_creating.html doesn't change...

  7. #7
    hum I dont know if it's possible, it should be, I'll try to find something for you.

  8. #8
    Hi,
    Thanks a lot for the help. that worked great!!

    I made some changes though:

    index.html
    PHP Code:
    <HTML>
    <
    HEAD>
    <
    TITLE></TITLE>
    </
    HEAD>
    <
    BODY onLoad="window.open('pop_creating.html', 'popcreate', 'width=250,height=20,left=450,top=250');">
    <
    A href="nextpage.html">Next Page</A>
    </
    BODY>
    </
    HTML
    nextpage.html
    PHP Code:
    <HTML>
    <
    HEAD>
        <
    TITLE></TITLE>
        <
    SCRIPT TYPE="text/javascript"><!--

        function 
    popcreating ()
        {
            
    mywin window.open("pop_creating.html""popcreate""width=250,height=20,left=450,top=250,scrollbars=no,resizable=no,status=no");

            
    mywin.close();
        }
            -->
    </SCRIPT>
    </HEAD>
    <BODY onLoad="popcreating ();">
    <A href="nextpage.html">Next Page</A>
    </BODY>
    </HTML> 

    Thanks for the help!

    Powi

Posting Permissions

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