Results 1 to 2 of 2

Thread: Open a popup and close it again from parent (opener) window

  1. #1
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default Open a popup and close it again from parent (opener) window

    Hi,

    I was wondering... is it possible to open a popup and then close it again from a button on the parent/opener window?

    I can open a popup and close it via a button in the popup itself but I cant find a way of closing it from the parent.

    If someone knows how, can you post an example please?

    Thanks

    Beverley
    Last edited by Beverleyh; 07-31-2008 at 06:27 AM. Reason: spelling errors

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Ignore me - I got it

    Code:
    <head>
    
    <script language="javascript" type="text/javascript">
    <!--
    var newwindow = '';
    function PopUpWin(url) {
    newwindow=window.open(url,'popupname','width=250,height=250,left=100,top=100,resizable=no');
    }
    
    function ClosePopUpWin(){   
    newwindow.close();
    }
    // -->
    </script>
    
    </head>

    Code:
    <body>
    
    <form>
    <input type=button onClick="return PopUpWin('popup.html');" value="Open">
    <input type=button onClick="ClosePopUpWin();" value="Close">
    </form>
    
    </body>

    Then obviously you need the "popup.html" page that will open in the popup window.

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
  •