Page 1 of 1

javascript frames and windows

Posted: Wed Jun 11, 2003 5:35 am
by Lookie23
Hello!

I have a question regarding document object model with frames.
What i would like to know is... when browser loads a frameset, does that mean that frameset becomes kind of a window object? If so, what is then the _parent or _top object of frameset? So, i guess that child objects -frames themselves are - also window objects, containing documents. Oh, and maybe just one more thing...if I would set target attribute of a child obj (frame) to _top, where would it load - to frameset or normal browser window? Thanks in advance for any help or tips!

Posted: Wed Jun 11, 2003 6:18 am
by []InTeR[]
In html, the _top _parent _self etc.. Has are some specials 'targets'.
And only used in html. So if you want to change the frameset in a child html page you can use the TARGET attribute with the content _parent to change the frameset that is above the child html page...

If you have a frameset within a frameset, the _parent will only change the first frameset of the child. To change the most top frameset you will have to use the _top in the TARGET.

This all is only in html, to do this in javascript you can use these atributes if they where objects..

example, we have 1 frameset with 2 pages, names as menu and bottom.
The bottom page has for it self a middle and left as a frameset.

Code: Select all

// all in javascript.
  // to change to menu from the middle page.
  top.menu.location = 'newmenu.html';
  // in html <A HREF="newmenu.html' TARGET="menu">
  // or
  parent.parent.menu.location = 'newmenu.html';

  // to change the middle from the left...
  parent.middle.location = 'test.html';
  // in html <A HREF="middle.html' TARGET="menu">

  // to change the frameset with middle and left from middle
  parent.location = 'newbottomframe.html';
  // in html <A HREF="middle.html' TARGET="_parent">

  // to change the top frameset
  top.location = 'wholenewpage.html';
  // in html <A HREF="middle.html' TARGET="_top">
i hope this helpes