View Full Version : Question about floating frames
Paddy
02-25-2006, 05:56 PM
Right, slight dilemma and I'm not sure how to get around it.
I've got a basic page layout - a banner across the top, with a vertical banner underneath and an <iframe> tag displaying all my links next to that.
Is there anyway I can get it so that my top banner changes in accordance to what's being displayed in the floating frame? Since it isn't actually part of the frame I've been assuming that this is not possible, but is it?
jscheuer1
02-25-2006, 06:15 PM
This cannot be done with just HTML but -
The banner, if it is an image and the first image on the top page would be in javascript known as:
parent.document.images[0]
on a page loaded in the iframe.
So, if you load a page into the iframe, you could put something like so in its body tag:
<body onload="parent.document.images[0].src='some.jpg';">
It would be better to give the banner image a name and access it that way (avoiding conflicts with images on the content page if it were loaded by itself), ex (on the top page):
<img src="whatever.jpg" name="banner">
Then it will be know in the iframe as:
parent.document.images.banner
and accessed via an iframe loaded document's body tag like so:
<body onload="parent.document.images.banner.src='some.jpg';">
Paddy
03-10-2006, 02:30 PM
Right... I've no previous knowledge of JavaScript so I'm not entirely sure how I would implement this. Could it be explained any simpler? :(
jscheuer1
03-10-2006, 03:25 PM
Right, I gave you more information than you needed -
Give the banner image a name (red & green), ex (on your top page):
<img src="whatever.jpg" name="banner">
On the page(s) loaded in the iframe use something like this (red & green) in the body tag:
<body onload="parent.document.images.banner.src='some.jpg';">
Be sure to use the same name (banner) in both places. The image files can be any of your choosing, as long as they are available to the pages.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.