[Home]  [Edit this page]  [Recent Changes]  [Special Pages]  [Help
HowToJavaScriptLoadMultipleFramesAndReplaceSameFrame

How to load multiple frames and replace the same frame as well?

Create a frameset with one horizontal and two vertical frames. The script later will identify the frame by its name attribute.

<html>
<head>
<title>Frameset</title>
</head>
<frameset rows="10%,*">
<frame name=_h src="header.htm">
<frameset cols="20%,*">
<frame name=_l src="toc.htm">
<frame name=_r src="main.htm">
</frameset>
</frameset>
</html>


Create all the pages you need then place this function between script tags in each page that has a side list in another frame. The location object is used to assign a URL to the location property of an object.

Note that frames on the same level of hierarchy can only be accessed through their parent window.
function loadTOC()
{
parent._l.location = "toc01.htm";
}


Place this function between script tags in the header pages, and target contents into the relevant frames.

function loadH_01()
{
top._h.location = "header_01.htm";
}
function loadH_02()
{
top._h.location = "header_02.htm";
}


<a href="main.htm" target="_r">Home</a>
<a href="01.htm" target="_r">Main 1</a>
<a href="02.htm" target="_r">Main 2</a>
<a href="main_01.htm" target="_r" onclick="loadH_01()">Link 1</a>
<a href="main_02.htm" target="_r" onclick="loadH_02()">Link 2</a>


Related threads:
Load pages in frames

Java Script FAQ

last edited (April 19, 2004) by leeos, Number of views: 1962, Current Rev: 5 (Diff)

[Edit this page]  [Page history]  [What links here]  [Discuss this topic]  [Printer Friendly]  

Members

Username:

Password:


Register
Forgot Password?




Programmers Heaven - for .NET, Java, C/C++ and WEB Developers!
© 1996-2008 Community Networks Ltd. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Tore Nestenius at .NET Consultant - Synchron Data.