SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2002
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    closing popup window once parent page loads

    Hi,

    I have something very simple but my beginners knowledge is making it very complicated. Basically, I have a pop up window that appears once an image has loaded in the parent page:

    COLOR=crimson]<IMG src="images/title_salem2.gif" WIDTH="339" HEIGHT="47" ALT="" BORDER="0" onLoad="javascript:window.open('popup.html','pop','scrollbars=no,menubar=no,resizable=no,width=270,height=280');">[/COLOR]

    There's a link on the popup window to "CLICK HERE", which then loads a new page in the parent window.

    Now I just want to have the popup window to close once you click on the link "CLICK HERE".

    Can someone help me please!

    Thanks
    Buttafly Jones

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add this to the link in the pop-up windows:

    Code:
    OnClick="window.close();"
    I assume you also used JavaScript to load a new page in the parent window. The window.close(); command can just be sticked at the end of that code.

  3. #3
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a twist

    How about a twist on this:

    I have a page with a link that loads another page. No problem, straight html. However the loaded page takes some time to load since it's parsing some PHP. So I created a little javascript that opens a new popup window that says "your page is being loade, chill out" or something. I called this popup window "popup" from the javascript that opens it:

    onClick="window.open('url', 'popup', width, height)

    Now what I want to do is close the popup window once the called page loads. So I thought that if I put into the called page:

    <body onLoad="window.close('popup')>

    it would do the trick, but all it does is close itself! How can I tell it to close the popup window?
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com


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
  •