SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Wizard
    Join Date
    Apr 2002
    Location
    Brisbane QLD Australia
    Posts
    1,489
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    click pop up, close pop up and load page in main window. how?

    Hi Guys,

    This what I'm wanting to do.

    a) person goes to my web site.

    b) index page site loads in main window.

    c) small pop up loads.

    d) user clicks link in pop up.

    e) pop up closes and loads new page in main window.

    It's the (e) section that i can't figure out. i can't find any javascript thing that can do this. though i'm sure i've seen it done before.

    any help would be much appeciated.

    anthony

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Here ya go!
    Code:
    <a href="somepage.html" target="_parent" onclick="self.close();">Close Window and Load New Page!</a>

  3. #3
    SitePoint Wizard
    Join Date
    Apr 2002
    Location
    Brisbane QLD Australia
    Posts
    1,489
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Mate!

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by billiousness
    Thanks Mate!
    No problem!

  5. #5
    SitePoint Wizard
    Join Date
    Apr 2002
    Location
    Brisbane QLD Australia
    Posts
    1,489
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey vgarcia,

    i've implmented that code but its not loading the intended page in the parent window. See http://www.fugly.com.au/awards

    any ideas???

    thanks

  6. #6
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    _parent won't do it in this situation as _parent actually refers to the containing page (such as the page which hold an iframe or the frameset).

    To target the opener you will need to use javascript:


    This version beongs inthe popup page (the one in the popup window.
    Code:
    <script type="text/javascript">
    
    function maillist() {
    window.opener.location.href = 'maillist.html' ;
    self.close();
    }
    
    </script>
    
    ...
    
    <a href="#" onclick="maillist();">Join our mailing list</a>

    Alternatively (as well as more simply and more flexibly) you can place the following code into the head of your main/start page:

    Code:
    <script type="text/javascript">
    
    self.name = 'mainWin';
    
    </script>
    ...and then target it as you would any other window:

    Code:
    <a href="#" target="mainWin" onclick="self.close();">Join our mailing list</a>
    Last edited by Bill Posters; Apr 3, 2003 at 07:18.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  7. #7
    SitePoint Wizard
    Join Date
    Apr 2002
    Location
    Brisbane QLD Australia
    Posts
    1,489
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yay!!

    Thanks so much for that!

    You better watch out when your on these boards cause when I find you I'm gonna give you a big hug!

    Alternatively if you need any writing or marketing ideas give me a pm.

    Cheers

  8. #8
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by billiousness
    Yay!!

    Thanks so much for that!

    You better watch out when your on these boards cause when I find you I'm gonna give you a big hug!


    Alternatively if you need any writing or marketing ideas give me a pm.
    I'll bear that in mind. Thx.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  9. #9
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, I'm trying this and I'm still missing something. It works in IE - but it is not working in Firefox, so what other gotha's do I need to fix this.

    The page in question is here:

    http://www.ptotoday.com/yellowpages/index1.html

    And the button to the popup window is to the bottom in the center of the screen:
    "Current customers: LOG IN"

    This pops a window up. The popup closes when you click on a link. But in Firefox, the targeted page never loads -- according to the status bar, it sits there waiting...


    I named the main window as suggested. From that main page you click to the popup which lists a group of links. When you select a link, it targets "mainWin". That is the link that is going no where in Firefox.

    Ideas?

    Thanks,
    Marianne
    Last edited by MarnieB; Apr 27, 2005 at 13:11. Reason: more info provided

  10. #10
    SitePoint Addict
    Join Date
    Jan 2005
    Location
    Ireland
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems to work for me...?

  11. #11
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it working late last night after making some other changes. Thanks!

    I'm all set.


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
  •