SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Activating link in parent window

    I have a parent page with several links on it. Each link has onclick code which calls the following JS function:

    Code:
    function NewWindow(mypage,myname,w,h,scroll)
    {
       LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
       TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
       settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',directories=no,location=no,menubar=no,resizable=no,scrollbars='+scroll+',status=no,toolbar=no';
       win = window.open(mypage,myname,settings);
    }
    In the new window, I want to click on a link there and send the parent window to that link. I hope that makes sense.

    I have tried doing an <a href='...' target='_parent'></a> which doesn't work. I also added onclick code in the child window which says:

    Code:
    onclick="parent.location.href='...'; return true;"
    That didn't work either. Everything I do sends the child window to the link. I need to send the parent window to the clicked link.

    Any help would be greatly appreciated. Thank you.

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:
    onClick="opener.location.href='...'"

    The term "opener" refers to the window that opend the child window.

  3. #3
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did the trick. Thank you very much!


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
  •