We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

frame,frameset opening popup window

Medium Priority
1,461 Views
Last Modified: 2013-11-19
i have a page mypage.php in it like below

<html>
      <head>
      
      </head>
<frameset rows="143,*" border="1">
        <frame id="g1" name="g1" src="g1.php">
        <frameset cols="80,*" id="cols">
            <frameset rows="50%,50%">
                        <frame id="g2" name="g2" src="g2.php">
                        <frame id="g3" name="g3" src="g3.php">
               </frameset>
              <frame id="pop1" name="pop1" src="../mydocs/lessons/lesson1/pop1.php">
        </frameset>
</frameset>
</html>

pop1.php content is like below

<html>
      <head>
            <script>
                  function open_popup(){
                        window.open('pop2.php','2','width=400,height=200,scrollbars');
                        return false;
                  }
            </script>
      </head>
      <body>
            <a href="#" onclick="open_popup();">POP2</a>      
      </body>
</html>

Everything is ok you see my main mypage.php and pop1.php are not in same directory. i want to open pop2.php which it is same directory with mypage.php. Above example opens pop2.php in where is pop1.php.

i can solve it writing.
window.open("../../../pop2.php","2","width=400,height=200,scrollbars");return false;
but i dont like in that way. because my pages url changes everytime.

i need like reaching from child page to main parent page directory and opening in this directory.

i think it can be like window.parent.open or something like that

please help thanks.
Comment
Watch Question

CERTIFIED EXPERT

Commented:
you means relocation parent frame to another page from frame tag? try this
<a href="#" onclick="top.location.href='http://www.google.com';">goto google</a>
<a href="#" onclick="parent.location.href='http://www.google.com';">goto google</a>
OR open a popup from parent frame?
<a href="#" onclick="top.open('http://www.google.com');">pop up</a>
<a href="#" onclick="parent.open('http://www.google.com');">pop up</a>

 I hope I understood your question
Commented:
the java script in pop1.php will be  as following


test and tell me

<html>
      <head>
            <script>
                  function open_popup(){
                  var fullurl = parent.location.href.split("/")
                  var len = fullurl.length - 1;
                  fullurl[len] = "pop2.php"
                  var newurl = fullurl[0];
                  for(var i = 1; i < fullurl.length; i++)
                   {
                       newurl =  newurl + "/" + fullurl[i];
                   }
 
 
                        window.open(newurl,'2','width=400,height=200,scrollbars');
                        return false;
                  }
            </script>
      </head>
      <body>
            <a href="#" onclick="open_popup();">POP2</a>
      </body>
</html>

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Thank you very much
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.