Results 1 to 4 of 4

Thread: Question about floating frames

  1. #1
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Question about floating frames

    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?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    Code:
    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:

    HTML Code:
    <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):

    HTML Code:
    <img src="whatever.jpg" name="banner">
    Then it will be know in the iframe as:

    Code:
    parent.document.images.banner
    and accessed via an iframe loaded document's body tag like so:

    HTML Code:
    <body onload="parent.document.images.banner.src='some.jpg';">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Right, I gave you more information than you needed -

    Give the banner image a name (red & green), ex (on your top page):

    Code:
    <img src="whatever.jpg" name="banner">
    On the page(s) loaded in the iframe use something like this (red & green) in the body tag:

    Code:
    <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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •