Forum Moderators: open
I am having problems trying to link an IFRAME's content to another IFRAME (different page) which contains anchor tags in it.
Here is my situation:
"index.html" has an IFRAME named "faq" with the page "faq.html" in it.
In "faq.html", I have 12 different questions in it that link to 12 different answers on "faq_scroll.html" (using anchor tags) which is located in an IFRAME on "faq_page.html" (IFRAME named "faq_scroll").
"faq_scroll.html" has anchor tags to 12 different answers.
From the 12 different questions links on "faq.html" (located in an IFRAME on "index.html") to "faq_scroll.html" (located in an IFRAME on "faq_page.html) that contains 12 different answers with anchor tag links to each answer(faq1 - faq12).
I can easily link to the proper page (faq_page.html) with the proper target (faq_scroll), but I don't know how to tell it to YES goto "faq_page.html", but to the specific anchor tag located inside "faq_scroll.html".
NOTE: I AM NOT GOOD WITH JAVASCRIPT - so please be kind to explain in depth.
SOMEONE PLEASE HELP.
THANKS IN ADVANCE.
How many total pages? I read 4 in your post...
index.html
faq.html
faq_page.html
faq_scroll.html
... and I can't see what the difference is between faq.html and faq_page.html. So I'm assuming that there is only one page here.
It seems to me that this should not need javascript - but only require standard "named" anchors - i.e. FAQ number 1 on faq_page.html would link to "faq_scroll.html#faq1" in the iframe.
I never tried a scheme like this - don't iframes respond to named anchors in links?
SORRY FOR THE LATE POST.
- index.html contains an iframe in it containing faq.html (iframe name = faq)
- faq.html contains a list of questions (12 to be exact)
- from faq.html, I need each question to link to each answer (each answer has an anchor tag - faq1 to faq12)
- the answers are located in faq_scroll.html which is THE iframe for faq_page.html (main page)
HOW CAN I LINK FROM faq.html (iframe of index.html) to faq_scroll.html#faq1 to 12 (iframe of faq_page.html)?
I know how to link it to faq_scroll.html#faq1 - 12, but it is obviously not showing up in an iframe on faq_page.html like it should.
ANY SUGGESTIONS?
It's more advanced then you think.
I already know how to properly link iframes using the proper target(iframe name) and anchor (#faq etc).
The problem is this:
From the iframe 'faq' containing the page 'faq.html' (iframe 'faq' is placed inside the page 'index.html'), I need to link to the iframe 'faq_scroll' containing the page 'faq_scroll.html' which has 12 different anchor tags (faq1 - faq12) to each answer (iframe 'faq_scroll' is placed inside the page 'maintenance.html').
faq.html contains 12 different questions
faq_scroll.html contains 12 different answers (12 anchor tags)
Sure, I can link to just faq_scroll.html with the proper anchor links, but then the iframe 'faq_scroll' will not be displayed inside of 'maintenance.html'.
That's my problem.
If that is the setup, you'll need to pass the anchor name as a query string variable from one page to the next -- then pull out the anchor name from the URL. Then you need to write the anchor name dynamically into the iframe code on maintenance.html. You're original links would be relatively easy:
<a href="maintenance.html?faq1 target="_top">FAQ 1</a>
Then the code on maintenance.html would be the complication. First, in the head, call this javascript. It will isolate the anchor name from the URL and assign it to the variable anchorname:
origURL = parent.document.URL
anchorname = origURL.substring(origURL.indexOf('?')+1, origURL.length)
Then, in the body, write the iframe into the page with document.write(), so you can change the named anchor according to the FAQ that was clicked - something like this:
document.write('<iframe src="faq_scroll.html#' + anchorname + '" name="faq_scroll"></iframe>')