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 4 of 4
  1. #1
    Regular Coder ellisd5's Avatar
    Join Date
    Jun 2002
    Location
    Uk
    Posts
    160
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Closing Child windows if it exists

    I call a function in my code called openPopup which opens a new window. This openPoup function is a function that is used throughout the a site and I cannot change the code, if I could I would put a var myWin = in front of it to reference it.

    The code in this function is basically this...
    Code:
    window.open(url,null,"attributes....");
    So how do I access this window given that there is no varaible set to it and the name attribute is set to null?

    The window might not be open at all so do I check its there and close if it is, I guss there is a way from teh window object to check for children.
    Dale Ellis
    __________________

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    open the popup as a variable
    var mywin = window.open(url,null,"attributes....");

    now you can chech if the variable exists:

    if(!mywin){//if the window does not exist
    ... do something...
    }

    or check for boolean true:
    if(mywin)
    Last edited by Kor; 10-20-2005 at 05:25 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder ellisd5's Avatar
    Join Date
    Jun 2002
    Location
    Uk
    Posts
    160
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Sorry Kor that's not what im after, maybe I didn't explain it well.

    I can not edit the popup code. So if i was able to, I would do what you suggested but I can't modify that popup code.

    So what Im after is a way to reference the child window, without doing the var myWin = bit
    Dale Ellis
    __________________

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    you can not reference otherwise the child popup window.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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