PDA

View Full Version : Directing a page to another page within a frame


moxie
01-02-2003, 07:07 AM
Hi all,

I am new here, so be kind to me. :)

I have this problem. My main site is a 2 frames ('top' and 'main') page.

When any viewer tries to access a page (e.g. abc.html) by entering the direct URL, I will like each and every page to refresh the view with the top frame and abc.html.

Is there a JavaScript that can do so?

Thanks in advance.

Moxie

glenngv
01-02-2003, 07:50 AM
in your frameset page:

<html>
<head>
<script language="javascript">
<!--
function init(){
if (location.search){
top.frames['f2'].location.href=location.search.substring(1);
}
}
//-->
</script>
</head>
<frameset rows="30%,70%" onload="init()">
<frame name="f1" src="top.html">
<frame name="f2" src="abc.html">
</frameset>
</html>

in abc.html and other pages you want always framed:

<head>
<script language="javascript">
<!--
if (top==self) location.replace("framesetpage.html?"+location.href);
//-->
</script>
</head>