controlling an iframe from another iframe within a frame

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Wallace

    controlling an iframe from another iframe within a frame

    I need to know how to change the src property of an iframe from script
    that is executed in another iframe with both of these iframes being
    contained on a document which is then contained by another frame. I
    have done a bunch of searching on these groups all to no avail.
    I am new to javascript and learning so if someone can help me with
    this I would appreciate it.
  • William Morris

    #2
    Re: controlling an iframe from another iframe within a frame

    What you need to learn to do is navigate the document hierarchy, which is
    pretty simple once you get the hang of it. It should also be noted that
    unless you're willing to work with one browser and one browser only, you're
    not going to enjoy all the coding that makes this cross-browser compatible.
    For IE only, if I have an HTML file with an iFrame and I want to refer to
    that iFrame, I do this:

    document.myFram e.location = "http://www.yahoo.com"

    If I want to refer back to the document from my iframe, I do this in the
    iframe code:

    parent.somesett ing.somevalue = 'some new value'

    To refer to a second iframe from the first iframe:

    parent.secondIf rame.location = "http://www.google.com"

    To refer to the containing frame of the parent document of either iframe:

    parent.parent.s omeSetting.valu e = 'some new value'

    See how that works for you...

    - Wm

    --
    William Morris
    Product Development, Seritas LLC
    Kansas City, Missouri



    "James Wallace" <jwallace@btuti lities.com> wrote in message
    news:a5973e1a.0 405140730.1d0e3 6e5@posting.goo gle.com...[color=blue]
    > I need to know how to change the src property of an iframe from script
    > that is executed in another iframe with both of these iframes being
    > contained on a document which is then contained by another frame. I
    > have done a bunch of searching on these groups all to no avail.
    > I am new to javascript and learning so if someone can help me with
    > this I would appreciate it.[/color]


    Comment

    Working...