PDA

View Full Version : Dynamic frame pages help


customdh
11-16-2005, 05:31 PM
I'm making the template page for a school project site where I have a head frame at the top which contains links to change the side frame on the left. The side frame contains links to its subsections. The links in the side frame change the main frame to the right of the side frame. I'm using this kind of code:

(template file)
<frameset rows="85, *">
<frame src="head.html" name="headframe" />
<frameset cols="140, *">
<frame src="side1.html" name="sideframe" />
<frame src="main1.html" name="mainframe" />
</frameset>
</frameset>

(head)
<body>
<h6>Head</h6></br>
<a href="side1.html" target="sideframe">Side 1</a>
<a href="side2.html" target="sideframe">Side 2</a>
</body>

(side)
<body>
<h2>Side 1</h2></br>
<h2>Links</h2></br>
<a href="main1.html" target="mainframe">Main 1</a></br>
<a href="main2.html" target="mainframe">Main 2</a></br>
</body>

anyway, when I open say click the link in the side frame to open main page 2, then i click the link the in the head frame to open side frame 2, the main page stays on 2. I would like the main page to automatically open a default "home" page for the subsection loaded into the side frame. Basically, how do you set it so when I click on the side frame link in the head frame, so it automatically loads the main page 1, rather than still displaying the last main page on there? Anyone's insight and/or advice would be greatly appreciated.

Kalessin
11-17-2005, 05:58 AM
There are two relatively simple ways you could achieve this. The first is to have some JavaScript in the side page, so that when it's loaded it loads the main first page into your main frame<body onLoad="parent.mainframe.location='main1.html';">The other thing you could try is to set the link on the head frame so that when you click it and it loads the side content, it loads the main content too.<a href="side1.html" onClick="parent.mainframe.location='main1.html';">Side 1</a>Let me know if this works :)

Kal