• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1313
  • Last Modified:

frame,frameset opening popup window

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.
0
phparmy
Asked:
phparmy
1 Solution
 
fsze88Commented:
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
0
 
agamalCommented:
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

0
 
phparmyAuthor Commented:
Thank you very much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now