Creating a Child frame

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;
<!--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 =, name, params);
function LaunchFOL()
      var url = "folbox.html";
      var name = "FOL";
      launchWindow (url, name, 815, 450);

// -->


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

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


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

Who is Participating?
tecbuilderConnect With a Mentor Commented:
You need to use 'opener'.  For example:


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.
youngs101497Author Commented:
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?

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, then evaluates to undefined:

 - Close the main browser window:

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

 - 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:

- Change a property of the opener. The following code changes the background color of the window specified by the opener property:

youngs101497Author Commented:
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.


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.

All Courses

From novice to tech pro — start learning today.