469,954 Members | 1,879 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

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

Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <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>
  3. </body>
  4.  
and the child window code: pop-up1.php

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script type="text/javascript">
  3. function openparent (url) {
  4. if (window.opener &&!window.opener.closed){
  5. window.opener.location = url;
  6. }
  7. }
  8. </script> 
  9. </head>
  10. <body>
  11. <a href="green.php" onclick="openparent(this.href)"> a</a>
  12. <br  />
  13. <a href="index.php" onclick="openparent(this.href)"> 3</a>
  14. </body>
  15.  
Thanks for any input you have!!!
Oct 20 '10 #1
2 1438
Oralloy
983 Expert 512MB
I'm a little weak on syntax here, but I tried something like this, and it seemed to work:

Expand|Select|Wrap|Line Numbers
  1. <a href="index.php" onclick="this.parent.document.URL=this.href"> Clik Here</a>
Good Luck!
Oralloy
Oct 20 '10 #2
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!
Oct 20 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Xing Rong | last post: by
5 posts views Thread by Tim | last post: by
1 post views Thread by Bill Borg | last post: by
3 posts views Thread by Joe | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.