Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a Child frame

Posted on 1999-06-28
4
Medium Priority
?
175 Views
Last Modified: 2010-04-09
I built a Java program which runs in it's own window.(when it is initiated it is givin a new window to operate in) In some cases(helps) the Applet will need to change the web page displayed in the parent window.  The Java function is "getAppletContext().showDocument("help.html", "_parent");"
When this is called I don't want to change anything in the window in which the Applet is running, I do what to change the URL of the window which created the window in which the Applet in running. (confused?)

Currently I am creating the new window for the Applet using the following code;
//-------CODE
<Html>
<HEAD>
<!--Begin JavaScript code.-->

<script language="JavaScript">

<!--

function launchWindow (url, name, width, height) {
      var x = 0;
      var y = 0;

      //Position applet
      if (navigator.appVersion.length > 0 && navigator.appVersion.charAt(0) > '3' && navigator.appVersion.charAt(0) <= '9') {
            if(width > screen.availWidth - 12) {
                  width = screen.availWidth - 12;
            }
            if(height > screen.availHeight - 48) {
                  height = screen.availHeight - 48;
            }
            x = (screen.availWidth - 12 - width) / 2;
            y = (screen.availHeight - 48 - height) / 2;
      }
      var params =  "menu=0,status=1,scrollbars=0,resizable=0,screenX=" + x + ",screenY=" + y + ",width=" + width + ",height=" + height + ")";
      var windowvar = window.open(url, name, params);
}
function LaunchFOL()
{
      var url = "folbox.html";
      var name = "FOL";
      launchWindow (url, name, 815, 450);
}


// -->

</script>

<!--End inserted JavaScript code.-->

<a href="" onClick="LaunchFOL(); return false;" onMouseOver="window.status='FOL';return true">FOL</a>

</body>
</html>
//-------CODE

How can I make the created window understand it is the parrent window?

AJY.
0
Comment
Question by:youngs101497
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
tecbuilder earned 150 total points
ID: 1851295
You need to use 'opener'.  For example:

opener.location="YourURL.html"

Be aware however that not all browser versions know how to interpret opener.  'Opener' is the only way to get back to the original window.
0
 

Author Comment

by:youngs101497
ID: 1851296
If I use "opener.location"  I get a java script error refering to "opener."  I tried using window.location and that just changed the URL. I need to open a seperate window which can refer back to the opening window(parent window).

Am I just using "opener.location" improperly or what?

AJY.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1851297
Sorry, I was thinking one thing and wrote another.  From the child window you would refer back to the parent window as:  window.opener

Here are some examples:
 - Close the opener. The following code closes the window that opened the current window. When the opener window closes, opener is unchanged. However, window.opener.name then evaluates to undefined:
window.opener.close()

 - Close the main browser window:
top.opener.close()

 - Evaluate the name of the opener. A window can determine the name of its opener as follows:
document.write("<BR>opener property is " + window.opener.name)

 - Change the value of opener. The following code changes the value of the opener property to null. After this code executes, you cannot close the opener window as shown in the example above:
window.opener=null

- Change a property of the opener. The following code changes the background color of the window specified by the opener property:
window.opener.document.bgColor=’bisque’

tecbuilder
0
 

Author Comment

by:youngs101497
ID: 1851298
Your answer would have been very helpful if I was working with javascript only.  I am working with a Java applet.  I did find an acceptable way to work out my problem.  I should have presented the problem under a different heading.

Thanks,

AJY.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

688 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