Closing a popup before opening another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MJEASSOC

    Closing a popup before opening another

    I need some help with closing a popup window. I'm making an online portfolio,
    that has one base page with text and thumbnails. When a user clicks on a thumb,
    a new window opens containing a larger image and a caption (each contained on a
    separate htm document).

    I do this with a function in the header script as follows:

    var picpage=" ";
    var params=" ";

    function fullpicwin(picp age,params)
    {
    window.status=" Opening picture... please wait";
    window.open(pic page,'fullpic', params)
    }


    picpage (the name of the htm file), and params (window size, etc.) are passed
    from the click code by each thumb. Each popup is sized differently, of course,
    based on the side of the larger photo. All controls, etc., in the popup are
    turned off. The user can click the "x" box or a form button at the bottom of
    the popup to close the window.

    All this works very nicely... EXCEPT...

    The user can move the mouse back to the main page and open ANOTHER popup by
    clicking on another thumb BEFORE closing the existing popup. The problem is the
    2nd popup retains the size of the first, so of course the photo may be blocked
    by the borders, etc.

    What I want to do is force the closing of the first popup if the user tries to
    open a 2nd and so on. There is no reason to have more than one large photo
    showing at the same time.

    I thought I could put some code in the function that checks for the existence
    of a window named "fullpic", and if it's there, closes it first, then opens
    another. But I can't seem to get the syntax right.

    Any suggestions appreciated.

    TVMIA......


  • Michael Winter

    #2
    Re: Closing a popup before opening another

    On 09 Sep 2004 21:39:36 GMT, MJEASSOC <mjeassoc@aol.c om> wrote:

    [snip]

    Please read the FAQ, specifically section 4.10.

    <URL:http://jibbering.com/faq/>

    Good luck,
    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    Working...