chrome2000
asked on
anchors, links, frames
hi everyone:
i am using frames on couple of pages of my website. now, if i try to link to a section (anchor) of one of the pages that is part of the frameset, it always goes to the top of the page. this is what i mean:
my files look like this:
frameset1.htm
untitledFrame-1.htm
untitledFrame-2.htm
untitledFrame-3.htm
as you can see, frameset1.htm controls the positioning and so on of the untitledFrame-1.htm, untitledFrame-2.htm, and untitledFrame-3.htm pages. these are three sections one next to the other one. i am interested in creating an anchor in one of the pages, let say on untitledFrame-2.htm. now i need to link to that section by somehow calling href=frameset1.htm (to keep all the sections together) but at the same time to the anchor on untitledFrame-2.htm
is that clear ???
thanks.
i am using frames on couple of pages of my website. now, if i try to link to a section (anchor) of one of the pages that is part of the frameset, it always goes to the top of the page. this is what i mean:
my files look like this:
frameset1.htm
untitledFrame-1.htm
untitledFrame-2.htm
untitledFrame-3.htm
as you can see, frameset1.htm controls the positioning and so on of the untitledFrame-1.htm, untitledFrame-2.htm, and untitledFrame-3.htm pages. these are three sections one next to the other one. i am interested in creating an anchor in one of the pages, let say on untitledFrame-2.htm. now i need to link to that section by somehow calling href=frameset1.htm (to keep all the sections together) but at the same time to the anchor on untitledFrame-2.htm
is that clear ???
thanks.
and in each of the three pages you have anchors like this:
content
<A name="anchor1"></a>
content
content
<A name="anchor1"></a>
content
hmm, you may have to specify the entire page name -- i'm not sure:
... top.frame1.location='untit ledFrame-1 .htm#ancho r1'; ...
... top.frame1.location='untit
also, the code above assumes your frames are named "frame1","frame2","frame3"
oh! now I re-read your Q and I think i got it ...
You can do this in your link to the frameset page:
<A href="frameset1.htm?anchor 2" > open frameset </a>
then in the frameset page, do this:
<FRAMESET>
<FRAME name="frame1" src="untitledFrame-1.htm" >
<FRAME name="frame2" >
<FRAME name="frame3" src="untitledFrame-3.htm" >
</FRAMSET>
<SCRIPT language="javascript">
top.frames["frame2"].locat ion = "untitledFrame-2.htm#" + location.search.substring( 1);
</SCRIPT>
You can do this in your link to the frameset page:
<A href="frameset1.htm?anchor
then in the frameset page, do this:
<FRAMESET>
<FRAME name="frame1" src="untitledFrame-1.htm" >
<FRAME name="frame2" >
<FRAME name="frame3" src="untitledFrame-3.htm" >
</FRAMSET>
<SCRIPT language="javascript">
top.frames["frame2"].locat
</SCRIPT>
... and in untitledFrame-2.htm you have an anchor:
content
<A name="anchor2"></a>
content
content
<A name="anchor2"></a>
content
ASKER
hold on my man, i have to digest this slowly
ok ... this worked for me ... here is the frameset page:
<HTML>
<SCRIPT language="javascript">
function onLoadHandler()
{
var f2url = "untitledFrame-2.htm#" + location.search.substring( 1);
alert(f2url);
top.frames["frame2"].locat ion = f2url;
}
</SCRIPT>
<FRAMESET rows="80,80,*" onload="onLoadHandler();">
<FRAME name="frame1" src="untitledFrame-1.htm" >
<FRAME name="frame2" >
<FRAME name="frame3" src="untitledFrame-3.htm" >
</FRAMSET>
</HTML>
<HTML>
<SCRIPT language="javascript">
function onLoadHandler()
{
var f2url = "untitledFrame-2.htm#" + location.search.substring(
alert(f2url);
top.frames["frame2"].locat
}
</SCRIPT>
<FRAMESET rows="80,80,*" onload="onLoadHandler();">
<FRAME name="frame1" src="untitledFrame-1.htm" >
<FRAME name="frame2" >
<FRAME name="frame3" src="untitledFrame-3.htm" >
</FRAMSET>
</HTML>
remove the alert, ofcourse.
Here is the link I used to open the above frameset page:
<A href="frameset1.htm?anchor 2" > open frameset </a>
and here is the frame2 page:
<html>
<body>
<p> content </p>
<p> content </p>
<p> content </p>
<A name="anchor2"></a>
<p> content </p>
<p> content </p>
<p> content </p>
</body>
</html>
Here is the link I used to open the above frameset page:
<A href="frameset1.htm?anchor
and here is the frame2 page:
<html>
<body>
<p> content </p>
<p> content </p>
<p> content </p>
<A name="anchor2"></a>
<p> content </p>
<p> content </p>
<p> content </p>
</body>
</html>
ASKER
hi knightEknight:
that did not work
here is how my code looks on the frameset page i hope you can copy it and paste it so you can see it more clear :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(p arseInt(ap pVersion)= =4)) {
document.MM_pgW=innerWidth ; document.MM_pgH=innerHeigh t; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_p gW || innerHeight!=document.MM_p gH) location.reload();
}
top.frames["centreFrame"]. location = "UntitledFrame-15.htm#" + location.search.substring( 1);
MM_reloadPage(true);
//-->
</script>
</head>
<frameset cols="153,*" frameborder="NO" border="0" framespacing="0">
<frame src="UntitledFrame-2.htm" name="leftFrame" scrolling="NO" noresize>
<frameset rows="*" cols="1,*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-3.htm" name="leftFrame1" scrolling="NO" noresize>
<frameset rows="*" cols="750,110" framespacing="0" frameborder="NO" border="0">
<frameset rows="*" cols="*,1" framespacing="0" frameborder="NO" border="0">
<frameset rows="54,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-6.htm" name="topFrame" scrolling="NO" noresize >
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-7.htm" name="topFrame1" scrolling="NO" noresize >
<frameset rows="10,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-8.htm" name="topFrame2" scrolling="NO" noresize >
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-9.htm" name="topFrame3" scrolling="NO" noresize >
<frameset rows="21,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-10.htm" name="topFrame4" scrolling="NO" noresize >
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-11.htm" name="topFrame5" scrolling="NO" noresize >
<frameset rows="10,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-12.htm" name="topFrame6" scrolling="NO" noresize >
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-13.htm" name="topFrame7" scrolling="NO" noresize >
<frameset rows="10,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-14.htm" name="topFrame8" scrolling="NO" noresize >
<frame name="centreFrame" >
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
<frame src="UntitledFrame-5.htm" name="rightFrame1" scrolling="NO" noresize>
</frameset>
<frame src="UntitledFrame-4.htm" name="rightFrame" scrolling="NO" noresize>
</frameset>
</frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>
here is the section where i link the picture to the section that i want to load:
<tr>
<td><a href="applications/applica tionss.htm l?pharmace uticals" onMouseOut="MM_swapImgRest ore()" onMouseOver="MM_swapImage( 'Image78', '','../../ images/gra phics/appl ications/g eneral_dar k.png',1)" ><img src="../../images/graphics /applicati ons/genera l_light.pn g" name="Image78" width="250" height="20" border="0"></a></td>
</tr>
here is my anchor in the page
<td width="35%" bordercolor="#666666" bgcolor="#D6D6C0" > <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a name="pharmaceuticals"></a >Pharmaceu ticals</st rong></fon t></div></ td>
sorry but i tried different things and i get this error
Not Found
The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. Please inform the site administrator of the referring page./
thank you for your help
rene
that did not work
here is how my code looks on the frameset page i hope you can copy it and paste it so you can see it more clear :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(p
document.MM_pgW=innerWidth
else if (innerWidth!=document.MM_p
}
top.frames["centreFrame"].
MM_reloadPage(true);
//-->
</script>
</head>
<frameset cols="153,*" frameborder="NO" border="0" framespacing="0">
<frame src="UntitledFrame-2.htm" name="leftFrame" scrolling="NO" noresize>
<frameset rows="*" cols="1,*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-3.htm" name="leftFrame1" scrolling="NO" noresize>
<frameset rows="*" cols="750,110" framespacing="0" frameborder="NO" border="0">
<frameset rows="*" cols="*,1" framespacing="0" frameborder="NO" border="0">
<frameset rows="54,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-6.htm" name="topFrame" scrolling="NO" noresize >
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-7.htm" name="topFrame1" scrolling="NO" noresize >
<frameset rows="10,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-8.htm" name="topFrame2" scrolling="NO" noresize >
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-9.htm" name="topFrame3" scrolling="NO" noresize >
<frameset rows="21,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-10.htm"
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-11.htm"
<frameset rows="10,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-12.htm"
<frameset rows="1,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-13.htm"
<frameset rows="10,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="UntitledFrame-14.htm"
<frame name="centreFrame" >
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
</frameset>
<frame src="UntitledFrame-5.htm" name="rightFrame1" scrolling="NO" noresize>
</frameset>
<frame src="UntitledFrame-4.htm" name="rightFrame" scrolling="NO" noresize>
</frameset>
</frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>
here is the section where i link the picture to the section that i want to load:
<tr>
<td><a href="applications/applica
</tr>
here is my anchor in the page
<td width="35%" bordercolor="#666666" bgcolor="#D6D6C0" > <div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a name="pharmaceuticals"></a
sorry but i tried different things and i get this error
Not Found
The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. Please inform the site administrator of the referring page./
thank you for your help
rene
ASKER
let my try what you wrote in your last couple of comments
ASKER
hi knightEknight:
still does not work. i think that the problem is on the script:
function onLoadHandler()
{
var f2url = "UntitledFrame-15.htm" ;
alert(f2url);
top.frames["centreFrame"]. location = f2url;
}
it shows the correct link on the alert(f2url) but when it tries to load the frame on the frameset it gives me this error:
Not Found
The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. Please inform the site administrator of the referring page.f
i think that the problem is here:
top.frames["centreFrame"]. location = f2url;
by the way both the frameset and each of the frames (pages), are in the same folder ????
any ideas ??
thanks
still does not work. i think that the problem is on the script:
function onLoadHandler()
{
var f2url = "UntitledFrame-15.htm" ;
alert(f2url);
top.frames["centreFrame"].
}
it shows the correct link on the alert(f2url) but when it tries to load the frame on the frameset it gives me this error:
Not Found
The requested object does not exist on this server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it. Please inform the site administrator of the referring page.f
i think that the problem is here:
top.frames["centreFrame"].
by the way both the frameset and each of the frames (pages), are in the same folder ????
any ideas ??
thanks
you will have to adjust for the number and level (heirarchy) of frames that you have.
ASKER
that is what i thought but if i just write it has it is, it means that i am at root ??
this is how my files and folders look
index.html (0)
pages folder (0)
-->main pages folder (1)
---->applications folder (2)
------>frameset.htm (3)
------>untitledframe.htm (3)
------>untitledframe2.htm (3)
------>untitledframe3.htm (3)
even better:
-what does this do ??
top.frames["centreFrame"]. location = f2url;
-i would rather understand what each thing do in this line
-should something like this do the trick ???
var f2url = "../../../UntitledFrame-15 .htm" ;
thank you very much
this is how my files and folders look
index.html (0)
pages folder (0)
-->main pages folder (1)
---->applications folder (2)
------>frameset.htm (3)
------>untitledframe.htm (3)
------>untitledframe2.htm (3)
------>untitledframe3.htm (3)
even better:
-what does this do ??
top.frames["centreFrame"].
-i would rather understand what each thing do in this line
-should something like this do the trick ???
var f2url = "../../../UntitledFrame-15
thank you very much
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi knightEknight:
i see what you mean, the only problem is that i have never play with this kind of code
top.leftFrame.leftFrame1.t opFrame.to pFrame1.to pFrame2 ... topFrameN.centreFrame.loca tion = f2url;
can you tell me how it works ?
thank you very much
i see what you mean, the only problem is that i have never play with this kind of code
top.leftFrame.leftFrame1.t
can you tell me how it works ?
thank you very much
<A href="#" onclick="top.frame1.locati