Re: Javascript question about 'parent'

by "Cyanide _7" <leo7278(at)>

 Date:  Wed, 23 Feb 2000 16:27:06 CST
 To:  mc_b2(at)
 Cc:  hwg-languages(at)
  todo: View Thread, Original
if the script is executed from the frame, parent will refer to the frameset, 
where parent.frames["right"] refers to the right frame. if you'd like to 
merely load the file "contents.htm" then:

parent.location.href = "contents.htm";

will do. if you want to load the actual contents of the right frame, and the 
contents are just files on your domain, then:

parent.location.href = parent.frames["right"].location.href;

if the contents happens to be on a different server, then i think it will 
merely return an empty string.

if the code is executed from the popup, you merely need to use the opener 
object which refers to the window object that opened it, in this case, the 
left frame:

opener.parent.location.href = opener.parent.frames["right"].location.href;

or you can shorten it by executing the code in reference to parent:

  location.href = frames["right"].location.href;

good luck - Cyanide_7

>It's the first tiem I post.
>I have a framed page, something like:
><.frameset cols="170,*">
><.frame name="left" src="menu">
><.frame name="right" src="contents">
>the file in the left frame, menu.htm contains a script which opens a new
>window with the same file in it:
>FloatMenu ='menu.htm'.'FloatMenu');
>AND then closes the frames or -better said- opens the contents in the full
>size main window, like this:
>Am I correct in assuming that the parent of FloatMenu is the frame named
>and when 'right' disappears, how should a javascript 'call' the main 
>(I tried parent, but it won't work).
>Basically, what I want to create a function to reopen the frames in the 
>window from the window called FloatMenu and load in the left frame the file
>that's in FloatMenu, and load in the right frame the fiel that's in the 
>window when the function is called.
>I know it's a rather messy explanation, and unfortunately I can't give any
>URL, because this thing is meant for local use.
>Hope you can give advice anyway (pls cc me, I am on the digest).
>Get Your Private, Free Email at

Get Your Private, Free Email at

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA