Click to See Complete Forum and Search --> : Forcing frames with JavaScript


LindaF
08-19-2003, 09:30 AM
I have a question about this code to force a page to open in a frameset:

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
if (parent.location.href == self.location.href) {
// change the url below to the url of the
// frameset page...
window.location.href = 'index.htm';
}
// End -->
</script>

I put this code in the head of each page and it works, except that the page that opens in the main frame is always the introductory page (obviously) rather than the specific page (e.g., "contactinfo.htm"); how can I amend the code so that each specific page will open in the mainframe of the frameset, rather than the intro page?

Thanks!

Khalid Ali
08-19-2003, 10:45 AM
your question is vague..without seeing what your frameset looks like tis rather hard to answer this.

Fang
08-19-2003, 11:01 AM
Change this line:
window.location.href = 'index.htm?page='+location.pathname;
On your index.htm page you have to:
if(location.search)
// extract the page and load it to the correct frame.

pyro
08-19-2003, 11:24 AM
Take a look at http://www.webdevfaqs.com/javascript.php#forceframeset