There are many ways to do that. One is to simply create a frameset fo each content page and in the content page use this simple script:
Code:<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (parent.location.href == self.location.href) {
window.location.href = 'frameset.html';
}
// End -->
</script>
"frameset.html" should be replaced with the frame that would load that content.
But that's not the best way. Here is the best way:
Here is code for a three frame frameset. The default pages loaded in the frame are frame1.html, frame2.html and frame3.html
You can change that in the array in the code below.
Let's call the frames page "frameset.html"
Code:<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";
var str = location.search;
var pos = str.indexOf("&");
if (pos != -1) {
var num = str.substring(pos + 1, str.length);
window["ar" + num] = str.substring(1, pos);
}
// -->
</SCRIPT>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
document.write(
'<FRAMESET COLS="200, *">',
'<FRAME SRC="', ar0, '" NAME="leftcolumn">',
'<FRAMESET ROWS="100, *">',
'<FRAME SRC="', ar1, '" NAME="toprow">',
'<FRAME SRC="', ar2, '" NAME="bottomrow">',
'</FRAMESET>',
'</FRAMESET>'
);
// -->
</SCRIPT>
</HTML>
In that code the part that needs changing (other than the frame sizes etc) is:
Quote:var ar0 = "frame1.html";
var ar1 = "frame2.html";
var ar2 = "frame3.html";
Now each of the pages to be loaded in the frame should have this code:
Code:<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";
// -->
</SCRIPT>
</HEAD>
<BODY>
text
</BODY>
</HTML>
What needs to be changed for that code is:
Quote:if (top.location.href.indexOf("frameset.html") == -1)
top.location.href = "frameset.html?content.html&0";
Orange = frameset page
red = orphan page
blue = frame to load in (0,1 and 2)
In the example code 0 = left frame, 1 = top frame and 2 = the main frame
That method will work for as many pages as you would like.
Let me know if you need any more help with this.