Click to See Complete Forum and Search --> : frames array
Beach Bum
12-09-2002, 01:53 PM
i have a frameset that has two frames - named top and bottom.
then i load another frameset into bottom by replacing bottom (from top) with that frameset. that frameset has two frames named left and right. i did that with the following js in top:
parent.bottom.location.href = "newFrameset.htm";
so now we have top, left and right visible. top from the original frameset and left and right from another frameset which replaced bottom.
still with me?
now . . . from top i want to replace the page left. how do i specify that (or is it even possible since they are from two different framesets - but they are in the same window)?
i have tried everything i can think of.
gil davis
12-09-2002, 04:35 PM
I believe that you have committed a naming faux pas. The name "top" already refers to a window object. When you create a frameset using "top" as a name, you replace that object with your object. "top" refers to the uppermost containing window in a frame environment. So, "top" should always refer to the actual browser instance.
If you change the name from "top", you should be able to get to "left" from the renamed top frame using:
window.top.bottom.left.location.href
Using "parent" can be confusing. For example, from the "left" frame, "bottom" is the "parent". And the "parent" of "bottom" is the root window, "window.top".
Beach Bum
12-09-2002, 06:30 PM
gil -
i should have thought about the name top when i was making my example. i was tyring to make it logical to understand. that is what i get for making an example rather than using the real situation. the real name of my frames are
Frameset 1 - header and bottom
Frameset 2 - contents and target
and frameset 2 replaces bottom with this exact statement:
parent.bottom.location.href = "orchids.htm";
orchids.htm is the second frameset.
what i have now (with the real names) to replace the frame "contents" based on your comment is:
window.header.bottom.contents.location.href = "photo_gallery1.htm";
but that does not work either. i will keep playing with it.
i am puzzled why this does not work as i think i have the relationships right:
parent.bottom.contents.location.href = "photo_gallery1.htm";
that is why i question whether this is doable when going through 2 framesets.
gil davis
12-09-2002, 07:05 PM
Instead of
window.header.bottom.contents.location.href = "photo_gallery1.htm";
I think you want
window.top.header.bottom.contents.location.href = "photo_gallery1.htm";
"window.top" is (supposedly) always the top-most browser window (man, I'm starting to have "top" trauma).
Beach Bum
12-09-2002, 07:30 PM
that does not work either. i think i have tried about every combination there is. both with parent and window.top and even without either.
interesting puzzle that may not have a solution.
all this because i want to avoid loading another frameset in bottom. it works just fine if i do that. just wanted to avoid extra traffic with the frameset and target page that really do not have to be reloaded just to change the contents page.
d4d4ng
12-11-2002, 02:59 AM
IMO, if you want to change the frame named contents source HTML file, the correct relationship form the frame named header is window.top.bottom.contents.location.href = "photo_gallery1.htm"
Beach Bum
12-11-2002, 01:12 PM
thanks d4d4ng -
i am away now and will return to my development environment next week. i have to believe that i already tried that one - but i think i tried everything!
so i will specifically try that when i get back next week and repost the results.
thanks for the suggestion.
gil davis
12-11-2002, 01:34 PM
window.top.bottom.contents.location.href
I just did a test in NS 4, and that syntax works.
Beach Bum
12-16-2002, 06:22 PM
OK - back at it.
based on the above posts, here is what i have in the called function:
function testIt() {
parent.bottom.location.href = "orchids.htm";
window.top.bottom.contents.location.href = "photo_gallery1.htm";
}
the first line works fine - bottom is replaced with the new frameset in orchids.htm in both IE6 and NS7.
the second line is ignored in both IE6 and NS7. i don't have NS4 loaded to see how it works there.
this may remain a mystery.