Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    96
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Close other popups

    Hi,

    Is there anyway to close all popups in a html script?

    Thanks,

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,303
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    Yes.

    See http://www.tek-tips.com/faqs.cfm?fid=4740

    Store the name in an array when you open the popups, and loop through the array to close all open windows.


    <script type = "text/javascript">

    document.activePopup = new Array;

    function openWindow(sUrl,sName,sProps){
    document.activePopup.push(window.open(sUrl,sName,sProps))
    }

    function closePopup(){
    for(var x=0;x<document.activePopup.length;x++)
    document.activePopup[x].close()
    }

    </script>


    "The whole aim of practical politics is to keep the populace alarmed (and hence clamorous to be led to safety) by menacing it with an endless series of hobgoblins, all of them imaginary." - H.L. Mencken 1880-1956, American Editor, Author, Critic, Humorist

  • Users who have thanked Philip M for this post:

    icklechurch (06-22-2009)


  •  

    Posting Permissions

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