Solved

anchors, links, frames

Posted on 2003-10-28
18
381 Views
Last Modified: 2008-03-17
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.
0
Comment
Question by:chrome2000
  • 10
  • 6
18 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636244
actually, that isn't to clear :)  but if I can guess this -- you want a single click to simultaneously change the position of all three framed pages, correct?

<A href="#" onclick="top.frame1.location='#anchor1';top.frame2.location='#anchor2';top.frame3.location='#anchor3';return false;"> click </a>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636253
and in each of the three pages you have anchors like this:

  content
  <A name="anchor1"></a>
  content
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636262
hmm, you may have to specify the entire page name -- i'm not sure:

    ...  top.frame1.location='untitledFrame-1.htm#anchor1';  ...
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636276
also, the code above assumes your frames are named "frame1","frame2","frame3"
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636341
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?anchor2" > 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"].location = "untitledFrame-2.htm#" + location.search.substring(1);
</SCRIPT>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636348
... and in untitledFrame-2.htm you have an anchor:

  content
  <A name="anchor2"></a>
  content

0
 

Author Comment

by:chrome2000
ID: 9636434
hold on my man, i have to digest this slowly
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9636598
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"].location = 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>
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 33

Expert Comment

by:knightEknight
ID: 9636619
remove the alert, ofcourse.


Here is the link I used to open the above frameset page:

  <A href="frameset1.htm?anchor2" > 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>
0
 

Author Comment

by:chrome2000
ID: 9636696
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")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 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/applicationss.html?pharmaceuticals" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image78','','../../images/graphics/applications/general_dark.png',1)"><img src="../../images/graphics/applications/general_light.png" 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>Pharmaceuticals</strong></font></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
0
 

Author Comment

by:chrome2000
ID: 9636775
let my try what you wrote in your last couple of comments
0
 

Author Comment

by:chrome2000
ID: 9637256
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
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9637261
you will have to adjust for the number and level (heirarchy) of frames that you have.
0
 

Author Comment

by:chrome2000
ID: 9637677
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
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 80 total points
ID: 9638255
each set of frames is an array, and if you have nested frames then there are arrays within arrays -- and you have as many as I have ever seen.  Without going thru all of them, I can tell you that the topmost frame is called "top" and after that you will have to drill down something like this:

  top.leftFrame.leftFrame1.topFrame.topFrame1.topFrame2 ... topFrameN.centreFrame.location = f2url;
0
 

Author Comment

by:chrome2000
ID: 9643112
hi knightEknight:

i see what you mean, the only problem is that i have never play with this kind of code

top.leftFrame.leftFrame1.topFrame.topFrame1.topFrame2 ... topFrameN.centreFrame.location = f2url;

can you tell me how it works ?

thank you very much
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The Google Maps API offers various ways to draw dynamic and static maps.  Using a combination of PHP and JavaScript, you can draw active JavaScript maps that allow pan-and-zoom in the client browser window.  You can also draw "static" …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now