[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

frame,frameset opening popup window

Posted on 2009-02-18
3
Medium Priority
?
1,249 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.
0
Comment
Question by:phparmy
3 Comments
 
LVL 15

Expert Comment

by:fsze88
ID: 23669890
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
 
LVL 8

Accepted Solution

by:
agamal earned 2000 total points
ID: 23669991
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
 

Author Comment

by:phparmy
ID: 23715218
Thank you very much
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month19 days, 18 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question