Retrieve ANCHOR from IFRAME on page

mbay

Registered
Hello Everyone!!!

I have a question, and any advise or help would be greatly appreciated.

I know that ANCHORS situated on a page may be retrieved from another page using the method [a href="faq.html#here"].

How would I retrieve an ANCHOR within an IFRAME from another page.

Below are my codes.

Thank you all in advance,

mbay

--

[Help Page]
Code:
<html>
   <head>
      <title>Help</title>
   </head>
   <body>
      <table>
         <tr>
            <td>Below I will show an example of html. For those of you who don't know what HTML is, click <a href="faq_iframe.html#whatis">
            here</a></td>
         </tr>
         <tr>
            <td>Below I will show an example of tables. For those of you who don't know what tables are, click <a href="faq_iframe.html#table">here</a></td>
         </tr>
         <tr>
            <td>Below I will show an example of a hyperlink. For those of you who don't know what HYPERLINK is, click <a href="faq_iframe.html#hyper"> here</a></td>
         </tr>
      </table>
   </body>
</html>

--

[FAQ]
Code:
<html>
   <head>
      <title>FAQ</title>
      <script language="javascript">
         <!-- Hide the script from old browsers --
         function surfto(form) {
         var myindex=form.dest.selectedIndex
         var passed = form.dest.options[myindex].value
         var acomma = passed.indexOf(",")
         var chars = passed.length
         var filename = passed.substring(0,acomma)
         var where = passed.substring(acomma+1,chars)
         if(filename != "") {window.open(filename, target=where)};
         }
         //-->
      </script>
   </head>
   <body>
      <table>
         <tr>
            <td>
               <form name="myform">
                  <select class="pulldown" name="dest" size="1">
                     <option>Select An Option</option>
                     <option value="faq_iframe.html#whatis,FAQ">What is HTML</option>
                     <option value="faq_iframe.html#table,FAQ">What are tables?</option>
                     <option value="faq_iframe.html#hyper,FAQ">What are hyperlinks?</option>
                  </select>
                  &nbsp;
                  <input type="button" value="GO!" onclick="surfto(this.form)">
               </form>
            </td>
         </tr>
         <tr>
            <td>
               <IFRAME SRC="faq_iframe.html" Title="FAQ" SCROLLING="auto" NAME="FAQ" WIDTH="200" HEIGHT="200" ALIGN="center" FRAMEBORDER="no" style="border:15px ridge #0066FF"></IFRAME>
            </td>
         </tr>
      </table>
   </body>
</html>
--

[FAQ IFRAME]
Code:
<html>
   <head>
      <title>FAQ IFRAME</title>
   </head>
   <body>
      <table>
         <tr>
            <td><font size="7">Welcome to the FAQ SECTION</font></td>
         </tr>
         <tr>
            <td><a name="whatis"><b>What is Html?</b></a></td>
         </tr>
         <tr>
            <td>HTML ( H yper T ext M arkup L anguage) is the language used to write Web pages. You are looking at a Web page right now. </td>
         </tr>
         <tr>
            <td><a name="table"><b>What are tables?</b></a></td>
         </tr>
         <tr>
            <td>Think of your tabular information in light of the coding explained below. A table has heads where you explain what the columns/rows include, rows for information, cells for each item. In the following table, the first column contains the header information, each row explains an HTML table tag, and each cell contains a paired tag or an explanation of the tag's function.</td>
         </tr>
         <tr>
            <td><a name="hyper"><b>What are hyperlinks?</b></a></td>
         </tr>
         <tr>
            <td>Hyperlinks are what connect the world wide web, without them we would get nowhere without knowing the exact URL (Universal Resource Locater) of the document we are looking for. Hyperlinks or more commonly just called "links" can do many things, but they always call for an action. A link could open your email client, it can move you to different pages or it can move you to different spots within the same document.</td>
         </tr>
      </table>
   </body>
</html>
 
Hi

Well from my understanding if you want to retreive an anchor from an iframe you would go

<a href="Document.htm#Anchor" target="Iframe">Anchor</a>

I tried it out and it works so yeah

what i did is when you use an iframe you need to set the link as a target like if you want something to open in a new window you set it as target="_blank" And the target="Iframe" is what you have called your iframe. Hope this helps !

Oh and remember to put the <head></head> tags in your code cause you dont have them there from what i can see...
 
Hi Smithy!!!

thank you for your quick reply.

Your method works great!!!! Except there is one issue perhaps I have overlooked previously.

While using your code, it will open a new window and retrieve the ANCHOR from the [FAQ_IFRAME.HTML] page, but what I would like to attempt to do, is call from the [HELP.HTML] page call the ANCHOR that is in [FAQ_IFRAME.HTML] but have is displayed in the [FAQ.HTML] page which contains the drop down menu with the IFRAME and the embedded html document. I would prefer not to display the IFRAME in its own page, but keep it respectively in its displayed form in the [FAQ.HTML].

Thanks again for your help in advance,

mbay
 
Hi mbay,

Sorry if im wrong ive been having abit of blonde moments lately so ill try to answer this correctly. So is the FAQ_IFRAME.HTML page in a new window ? or is it in the iframe... Do you have msn maybe we could quickly talk about breifly ? Sorry i sorta dont get what your trying to say... sorry ..
 
Hi Smithy!!!

don't be sorry! At times, I have difficulty expressing what I am really trying to do, but the words don't come out clear.

Indeed [Faq_iframe.html] is the embedded file within the iframe.

If you'd like to speak via msn, I would be glad to do this if it is easier for you.

Thank you in advance,

mbay
 
mbay, if I understand what you're saying correctly, you want this to happen:

When someone clicks on a link from the help.html page, it'll open the faq.html page and set the iFrame there to the appropiate anchor based on the link from the help.html page.

So if they clicked on the "Below I will show an example of tables. For those of you who don't know what tables are, click here" link, then it would open the FAQ page and set the iFrame to display the "What are Tables" portion.

Is that what you're trying to do?

Also, make sure you put your elements in the correct order. You had your body tags wrapping your head tags, which isn't good. While not related to the issue at hand, it can cause other problems.

Code:
Incorrect:
----------
<html>
   <body>
      <head>
         <title>FAQ</title>
      </head>
      ........
   </body>
</html>


Correct:
--------
<html>
   <head>
      <title>FAQ</title>
   </head>
   <body>
      ........
   </body>
</html>
 
Hi MDNKY!!!!

thanks for your reply!!!!

yes - that is exactly what I want to do.

Any suggestions how to do this?

Thanks for your help in advance and thanks for the tip on the "body" tag. :)


mbay
 
So when someone clicks on the help html page it will like open a new page/window and then the iframe in the new page will be set to the faq page with the anchor right ? Well thats simple on the page with the new iframe the faq page or soemthing set the source as this or like use this iframe code

<IFRAME name=Iframe/name src=FAQ.HTML#ANCHORNAME width=width height=height frameborder=1/0 scrolling=yes/no/auto>
</IFRAME>

Ok so this iframe should go in a new page right called faq_frame.html or something with your iframe and the source of the iframe is faq.html#anchorname or whatever you want it do be. You can use that iframe code or you can use your own if you use that one remember to edit it to your page's specs and like the option/option is the options you have and if you dont want a frame border just delete that part of code. But i would probly use your own iframe code to keep the site in order.
 
Hi Smithy!!!!

I realized perhaps it is myself who is making a mistake in explaining myself.

There are 3 documents: [Help.html] , [Faq.html] , [Faq_iframe.html]

The "Help" page is where the "click here" button is situated.

The "Faq" page is a page that contains an iframe by the name of "FAQIFRAME"

The embedded document inside "FAQIFRAME" is "Faq_iframe.html" (Within the faq_iframe.html, there is an anchor titled "table".

--

If I use your suggestion, I may have to create a page for every button to ensure the exact location of the anchor, no?
 
So if am i right - the help page contains the links right that when you click on it you want those links then to go to the Faq.html page and then show the anchor in the iframe ??

Also this script here goes in you head tags might be handy in the near future for something. It refreshes the page to any other page and the 1 is the duration period. I thought you could use that and set the pagename as faq.html#anchor and put target="iframe" in there but it didnt work so yer......

<meta http-equiv="refresh" content="1;URL=Pagename.html#anchorname">
 
Hi Smithy!!!!

Thanks a lot for your efforts, I really appreciate it.

I think you are correct when there may have to be a page created for each button, which may proved to be a lot more work in the end.

I will attempt to do some more research in hope to find my answer.

Thanks again!!!

mbay
 
Oh sorry i posted twice above i accedintly presed the post button then i stoped it so ignore the above post
lol sorry......
 
Back
Top