Log in

View Full Version : Replace parent page within a iframe with child pages?



stew
06-26-2012, 04:42 PM
hi, Need help with a simple problem! which has the following criteria:

1) click on images link in iframe changes Parent page, click on another iframe image link changes Parent to another page (see below).

It may sound simple but I'm being googled it for days now and looked over many forums.
Code can be in html css or js, but please keep any answers simple as possible and post a full working example to work as I'm new to coding or recode the test site: http://www.howiepotter.com/parent.html

http://i48.tinypic.com/syme4h.jpg

http://i47.tinypic.com/ab0dqa.jpg

Dear coders, I simplify the problem; now all I need is the link page (see image above) to replace the parent page with the iframe. PS the link page don't have any iframes just a simple page. Hope this is possible, here is the code for the pages (below) please update with new code and post it. PS simple keep your answers as simple as possible as I'm new to coding. thanks for any help

Parent page code:

<body>
<iframe src="iframe.html" width="100%" height="150" frameborder="0" style="position:fixed; Left:0px; bottom:0px"/iframe>
Parent Start Page
</body>

iframe page code:

<body>
<a href="link.html">iframe Link</a>
</body>

link page code:

<body>
Link Page
</body>

jscheuer1
06-26-2012, 07:28 PM
Change:


<body>
<a href="link.html">iframe Link</a>
</body>

to:


<body>
<a href="link.html" target="_top">iframe Link</a>
</body>

stew
06-27-2012, 10:12 AM
thanks for your help & time jscheuer1,
I made the change but still not working, link page appears & iframe disappears see http://www.howiepotter.com/parent.html

what have I do wrong:confused:

jscheuer1
06-27-2012, 02:43 PM
Nothing. If you want an iframe to be on the link page, put one on it.

Unlike framesets, Iframes do not persist across pages. What you might want is a frameset, they're a lot more to think about though. And, as I say, if you just put an iframe on the link page, then it will be there.

Other ways:

You could use AJAX to import the content of the link page to the parent page.

Or have another iframe at the beginning of the parent page and load link page into it.

Whichever of those you do, the page in the bottom iframe would remain the same. That could be good or bad. But, if you simply add an iframe to link page, you can have any page be in there. It could be the same page or a different one.

stew
06-28-2012, 10:27 AM
understand.
Got a offbeat question: instead of using frame set & iframes, is there any other way of placing a timeline at the bottom of my site with horizontal scroller!... like soon type of fixed table with horizontal slide bar...

jscheuer1
06-28-2012, 02:48 PM
You can hard code it on each page, or use javascript with or without AJAX, or use a server side include. Those are the only other options I can think of at the moment.

stew
06-28-2012, 04:29 PM
I'm interested, how could this to done using only javascript...

jscheuer1
06-28-2012, 07:56 PM
You would make an external script that creates the elements that you want and inserts them into the page where you want them. This script could include whatever code, if any needed to animate those elements and/or make them responsive to user interaction.

The creation/insertion part could be done in at least several ways.

If AJAX (which is just javascript that can fetch the content of another page) were used, a separate file could contain the HTML markup that you want inserted. AJAX will only fetch content though, so if you want to animate it and/or make it interactive, you would do that after it was fetched and inserted to the page. All fairly standard for AJAX fetched content.