Re: Javascript question about 'parent'
by "Cyanide _7" <leo7278(at)hotmail.com>
|
Date: |
Wed, 23 Feb 2000 16:27:06 CST |
To: |
mc_b2(at)hotmail.com |
Cc: |
hwg-languages(at)hwg.org |
|
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:
with(window.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">
><./frameset>
>
>the file in the left frame, menu.htm contains a script which opens a new
>window with the same file in it:
>
>FloatMenu = window.open('menu.htm'.'FloatMenu');
>
>AND then closes the frames or -better said- opens the contents in the full
>size main window, like this:
>
>parent.location.href="contents.htm"
>
>Am I correct in assuming that the parent of FloatMenu is the frame named
>'right'?
>and when 'right' disappears, how should a javascript 'call' the main
>window?
>(I tried parent, but it won't work).
>
>Basically, what I want to create a function to reopen the frames in the
>main
>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
>main
>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).
>
>Thanks
>
>cristina
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA