www.webdeveloper.com
Results 1 to 8 of 8

Thread: close POPUP out of the main window?

  1. #1
    Join Date
    Mar 2005
    Posts
    23

    close POPUP out of the main window?

    hi,

    to do a popup with the possibility to close it by a button/link inside of the popup is no prob.
    But is it possible to set a link inside of the main window that closes the popup?

    im looking inside this forum but didn't find the right for me
    (maybe i understand not enought of js ;-) )

    thanks for your help/ideas

    Don

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    set the popup as a global variable, thus later you may close it

    var popUp;
    function openPop(){
    popUp = window.open('mypopup','win');
    }
    function closePop(){
    popUp.close();
    }

  3. #3
    Join Date
    Mar 2005
    Posts
    23
    hi,

    thanks for the fast answer!

    i put the code in a test file and it works fine.

    thats the solution i'm looking for.

    Don

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428

    Thumbs up

    I am glad to hear that, as I rarely give wrong solutions...

    Welcome to the Forum...!

  5. #5
    Join Date
    Mar 2005
    Posts
    23

    popup close out of each window?

    Hi,

    now opening and closing the popup out of the main window works fine.

    But now there is another prob.

    the close button is present on every page and the popup should be closed by clicking on the close button.

    at the time this works only if i click first on the open button.

    how can i solve this little prob?

    thanks for help

    don

  6. #6
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    I am not sure, but I am affraid that can not be done. The moment you open (in HTML mode) a new page starting from main page, there is no javascript relationship (or at least I don't see) remained between the new page and the popup...

    Anyway, I will put this question in other forums as well. If I have a positive answer, I will let you know the solution.

  7. #7
    Join Date
    Mar 2005
    Posts
    23
    hi,

    thanks for the fast response.

    my prob is, i had to put the possibility of sound in the site, and i dont want to use frames.
    so my idea was to put it into a popup that can be closed by a button from every site of the project.

    now it works only if the open button is clicked first (i think so a focus is set on the popup window)

    i've thought perhaps it is possible to set the focus on the window and close it only by clicking on the close button.

    ???

    ok hope you will find any ideas

    i will google a little bit...

    thanks don

  8. #8
    Join Date
    Mar 2005
    Posts
    23
    hi,

    opening and closing a popup by a button out of the main window is no prob.

    loading a new page the close button works only if the open button is clicked first.

    now someone told me that the close button should be work in the following way:

    1. test if the popup still exist
    2. if not, using window.open and the same window name to create a new reference on it
    3. close it immediately

    i tryed a little bit, but i'm no coder. So if there is anybody that can tell me the right way i would be verry grateful.

    thanks don

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles