Forum Moderators: open

Message Too Old, No Replies

image link to anchor in iframe

image link to anchor in iframe

         

user friendly

5:55 am on Aug 11, 2004 (gmt 0)

10+ Year Member



hi, okay heres how it is: i have a parent page with links down one side all images. next to them is an iframe with anchors in it. i wish to link from the images to the individual anchors in the iframe without opening a new page. all i have managed to get is a new page that has an error. im resonably good with html and javascript but if you could post the source code for this it would be much apreciated.

tedster

7:31 am on Aug 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, and welcome to the forums.

It all hangs on giving the iframe a name attribute - <iframe name="thisone" src="page.html"></iframe>

Then your links from the main page just need to have a target attribute:

<a href="page2.html" target="thisone"></a>

user friendly

8:35 am on Aug 11, 2004 (gmt 0)

10+ Year Member



thanks. my iframe is named welcome and the anchor is named albania (its a socom II webquiz for computer studies) and i have tried that but it seems to open in a new window. ill try it again and post what my result is.


EDIT: okay done but all it does is open in a new window it doesnt even go down to the anchor. ill tell you this though im not using iframes again talk about pain in the ass! lol

[edited by: user_friendly at 8:47 am (utc) on Aug. 11, 2004]

kaled

8:44 am on Aug 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I imagine that using javascript to set the IFRAME document.location value will work.

e.g.

iframe_name.location.replace('iframe_contents.html#iframe_anchor');

Kaled.

user friendly

8:50 am on Aug 11, 2004 (gmt 0)

10+ Year Member



il ltry that but im a little rusty on my javascript can i put that in a link?

user friendly

8:54 am on Aug 11, 2004 (gmt 0)

10+ Year Member



okay thanks alot man but its just opening a new window.

user friendly

9:47 am on Aug 11, 2004 (gmt 0)

10+ Year Member



fixed