Forum Moderators: open
Here's an example if it's confusing. Say the index page is about miter saws and has a list of links to companies that make them. When you click on a company link, the frameset opens with the nav in the top frame and the company website in the main frame.
I can do this all manually, I know, but that is a mucho pain. I am looking for a solution that is limited to javascript.
Help me! My brain exploded. Thanks.
Secondly, frames or iframes are addressed through the parent-child relationship scheme. There is a top window with subframes denoted in array notation. As in:
top.frames[0]
It is legitimate to frame documents within frames, in which case notation like this can be appropriate:
top.frames[0].frames[3].frames[1]
Also, each subframe can address its immediate parent frame as parent. Siblings can access siblings through the parent. For instance, the second child frame of another frame (parent.frames[1]) can address its sibling, the first child of the parent with:
parent.frames[0]
This is distinct from how windows address each other, which is based on the opener, as opposed to parent, relationship.
All that said, the easiest way go about the whole thing is to use iframes, give each iframe an ID, then use document.getElementById() to change the src value of the target iframe.