Forum Moderators: open

Message Too Old, No Replies

Frame reunion

Can anyone help

         

Munster

11:45 am on Feb 9, 2004 (gmt 0)

10+ Year Member



I have a framed html site, what I am looking to achieve is if I call a content page that is normally called into a framed page it brings the top frame with it. I have seen it done but I dont know what the code it. Can anyone help?

RonPK

3:01 pm on Feb 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe this question should get listed in the FAQ...

The page to be framed should open the index page with a query string containing the address of the page to be framed (unless it already resides in a frameset):

<script type="text/javascript">
if (top == self) location = "index.html?frPage=thispage.html";
</script>

In index.html, the idea is to have the whole frameset written by script and to insert the page to be framed:

<script type="text/javascript">
var frPage = location.search.substr(8);
frPage = frPage.length > 0? frPage : "homepage.html";
document.write('<frameset rows="50, *">');
document.write(' <frame src="top.html">');
document.write(' <frame src="' + frPage + '">');
document.write('</frameset>');
</script>

That's it, basically. You'll probably want to include <noframes> and <noscript> sections.