How to click on links in a child window to change the parent w/o changing child

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chris mtz

    How to click on links in a child window to change the parent w/o changing child

    I have a parent window that opens up a child window with a list of links. The child window needs to stay on the same page and when the links are clicked only affecting the parent window. Right now both of the windows are changing and I just need the parent to.

    here is the parent window code: pop-up.php

    Code:
    <body>
    <a href="javascript:void(0);" NAME="My Window Name" title=" My title here " onClick=window.open("pop-up1.php","Ratting","width=550,height=170,0,status=0,");>Click here to open the child window</a>
    </body>
    and the child window code: pop-up1.php

    Code:
    <head>
    <script type="text/javascript">
    function openparent (url) {
    if (window.opener &&!window.opener.closed){
    window.opener.location = url;
    }
    }
    </script> 
    </head>
    <body>
    <a href="green.php" onclick="openparent(this.href)"> a</a>
    <br  />
    <a href="index.php" onclick="openparent(this.href)"> 3</a>
    </body>
    Thanks for any input you have!!!
  • Oralloy
    Recognized Expert Contributor
    • Jun 2010
    • 988

    #2
    I'm a little weak on syntax here, but I tried something like this, and it seemed to work:

    Code:
    <a href="index.php" onclick="this.parent.document.URL=this.href"> Clik Here</a>
    Good Luck!
    Oralloy
    Last edited by Oralloy; Oct 20 '10, 04:14 PM. Reason: Added cheerful signature.

    Comment

    • chris mtz

      #3
      I actually need just the opposite of that. That line changes the child window but not the parent. I need the child to stay the same and the parent to change. Thank you for the help though!

      Comment

      Working...