Bodmins
08-13-2002, 11:38 AM
My problem is that my page is loading in the wrong frame.
When in frame 'rtop' (who's parent is 'main') I have a link which should point to frame 'main', but instead points to itself. I know the way to do it would be to put 'target="main"' in to <a href> but this is impossible with my existing javascript code which generates the links.
Is there a way to re-load the page in the 'main' frame if it gets incorrectly loaded in the 'rtop' frame?
Here is my code:
Parent frame
----------------
<html>
<head>
<title></title>
</head>
<frameset framespacing="0" border="false" frameborder=0 cols="160,*">
<frame name="contents" target="main" src="contents.htm">
<frame name="main" src="childframe.htm">
</frameset>
</html>
Child frame
--------------
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function rightloc() {
if (parent.frames[1].name != 'main'){
parent.main.location.href='childframe.htm'
}
}
//-->
</script>
<title></title>
</head>
<frameset rows="20%,*" onload="rightloc()">
<frame name="rtop" target="rbottom" src="/cgi-bin/test0.pl">
<frame name="rbottom" src="/cgi-bin/test1.pl">
</frameset>
</html>
When in frame 'rtop' (who's parent is 'main') I have a link which should point to frame 'main', but instead points to itself. I know the way to do it would be to put 'target="main"' in to <a href> but this is impossible with my existing javascript code which generates the links.
Is there a way to re-load the page in the 'main' frame if it gets incorrectly loaded in the 'rtop' frame?
Here is my code:
Parent frame
----------------
<html>
<head>
<title></title>
</head>
<frameset framespacing="0" border="false" frameborder=0 cols="160,*">
<frame name="contents" target="main" src="contents.htm">
<frame name="main" src="childframe.htm">
</frameset>
</html>
Child frame
--------------
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function rightloc() {
if (parent.frames[1].name != 'main'){
parent.main.location.href='childframe.htm'
}
}
//-->
</script>
<title></title>
</head>
<frameset rows="20%,*" onload="rightloc()">
<frame name="rtop" target="rbottom" src="/cgi-bin/test0.pl">
<frame name="rbottom" src="/cgi-bin/test1.pl">
</frameset>
</html>