Results 1 to 2 of 2

Thread: changing external content based on window content

  1. #1
    Join Date
    Mar 2005
    Location
    kent, england
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default changing external content based on window content

    Is it possible to change content outside of a scrollbar window when the window contents change? For example the window contains a list of cake recipes. There is a full list of all the recipe titles outside the window. The recipe title highlighted will change depending on what recipe text is currently in the window. Can anyone give me any clues/links to demos as to how to go about doing this?

  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

    The contained page can access a function on the container page like so:

    Code:
    window.parent.functionname()
    Armed with this knowledge, you can have on each recipe page:

    HTML Code:
    <body onload="window.parent.highlight('recipe_name')">
    "recipe_name" could simply be the id of the item on the parent page to be highlighted. Then put a function on the container page called highlight:

    Code:
    highlight(r_name){
    code here to highlight whatever you want
    }
    This seems a bit extraneous to me though, how else would a recipe get loaded in the iframe without someone clicking on its name on the parent page? Unless there is some other way, a simple onClick event on the parent page will take care of this.

    If you are using frames, not iframes, use:

    Code:
    parent.window.framename.functionname()
    Last edited by jscheuer1; 04-29-2005 at 08:19 PM.
    - 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
  •