Can someone please point the way? IFRAME troubles

Discussion in 'Javascript' started by alxasa@gmail.com, Jul 23, 2006.

  1. Guest

    Hi, this is my present configuration

    <FRAMESET ID="MAIN_BODY" FRAMESPACING="0" ROWS="100%,*"
    FRAMEBORDER="0">
    <FRAME NAME="frameA" SRC="./contentA.htm">
    <FRAME NAME="frameB" SRC="./contentB.htm">
    </FRAMESET>


    'contentA.htm' has a <IFRAME> inside of it, with the ID/NAME of
    "internal"

    So, what I want to do, is from this IFRAME named 'internal', call a
    Javascript function sitting in the contentB.htm file.

    I've tried: top.frameB.functionname() but get "frameB" is null or not
    an object.

    Any help would be really awesome. Thank you!

    Alexia
    , Jul 23, 2006
    #1
    1. Advertising

  2. wrote:
    > <FRAMESET ID="MAIN_BODY" FRAMESPACING="0" ROWS="100%,*">
    > <FRAME NAME="frameA" SRC="./contentA.htm">
    > <FRAME NAME="frameB" SRC="./contentB.htm">
    > </FRAMESET>
    >
    > 'contentA.htm' has a <IFRAME> inside of it [...]
    > So, what I want to do, is from this IFRAME named 'internal', call a
    > Javascript function sitting in the contentB.htm file.
    >
    > I've tried: top.frameB.functionname() but get "frameB" is null or not
    > an object.


    We have a corporate application that does this all the time. Using
    either "top." or "parent.parent." should work fine.

    One reason it wouldn't work is if one of the frames actually comes from
    a different website. Then security will prevent you from accessing the
    other frame.

    Cheers, Kev
    Kevin Darling, Jul 23, 2006
    #2
    1. Advertising

  3. Guest

    Kevin Darling wrote:
    > wrote:
    > > <FRAMESET ID="MAIN_BODY" FRAMESPACING="0" ROWS="100%,*">
    > > <FRAME NAME="frameA" SRC="./contentA.htm">
    > > <FRAME NAME="frameB" SRC="./contentB.htm">
    > > </FRAMESET>
    > >
    > > 'contentA.htm' has a <IFRAME> inside of it [...]
    > > So, what I want to do, is from this IFRAME named 'internal', call a
    > > Javascript function sitting in the contentB.htm file.
    > >
    > > I've tried: top.frameB.functionname() but get "frameB" is null or not
    > > an object.

    >
    > We have a corporate application that does this all the time. Using
    > either "top." or "parent.parent." should work fine.
    >
    > One reason it wouldn't work is if one of the frames actually comes from
    > a different website. Then security will prevent you from accessing the
    > other frame.
    >
    > Cheers, Kev


    Hi Kev! This is on the same domain, so no security issues. But, I
    tried both of those top.top.frameB.functionname() and
    parent.parent.frameB.functionname() but it doesn't work (still get the
    'null or not an object error') Do you think it be something else?
    Thank you so much for looking at this -- this is trying me bonkers!!
    , Jul 23, 2006
    #3
  4. jojo Guest

    wrote:

    >>> <FRAMESET ID="MAIN_BODY" FRAMESPACING="0" ROWS="100%,*">
    >>> <FRAME NAME="frameA" SRC="./contentA.htm">
    >>> <FRAME NAME="frameB" SRC="./contentB.htm">
    >>> </FRAMESET>
    >>>
    >>> 'contentA.htm' has a <IFRAME> inside of it [...]
    >>> So, what I want to do, is from this IFRAME named 'internal', call a
    >>> Javascript function sitting in the contentB.htm file.
    >>>
    >>> I've tried: top.frameB.functionname() but get "frameB" is null or not
    >>> an object.

    >> We have a corporate application that does this all the time. Using
    >> either "top." or "parent.parent." should work fine.
    >>
    >> One reason it wouldn't work is if one of the frames actually comes from
    >> a different website. Then security will prevent you from accessing the
    >> other frame.
    >>
    >> Cheers, Kev

    >
    > Hi Kev! This is on the same domain, so no security issues. But, I
    > tried both of those top.top.frameB.functionname() and
    > parent.parent.frameB.functionname() but it doesn't work (still get the
    > 'null or not an object error') Do you think it be something else?
    > Thank you so much for looking at this -- this is trying me bonkers!!
    >


    Don't know if it's the solution, but try top.frameB.document.functionname()

    HTH, jojo
    jojo, Jul 23, 2006
    #4
  5. wrote:
    > Hi Kev! This is on the same domain, so no security issues. But, I
    > tried both of those top.top.frameB.functionname() and
    > parent.parent.frameB.functionname() but it doesn't work (still get the
    > 'null or not an object error')


    Time to start debugging :)

    Put this line somewhere in your "internal" IFRAME page:

    alert(parent.name);

    It should say "frameA". If it fails or gives the iframe name
    "internal", then IE thinks whatever's in the IFRAME has no permission
    to break out of its box... in which case, IE limits parent and top to
    the IFRAME itself.

    Oh, and is it _exactly_ the same domain? Otherwise search the news
    group for "cross domain scripting" help.

    Etc. Kev
    Kevin Darling, Jul 23, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George
    Replies:
    1
    Views:
    310
  2. Bagbourne
    Replies:
    4
    Views:
    352
  3. Replies:
    4
    Views:
    553
    Kevin Darling
    Jul 23, 2006
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,322
    Saraswati lakki
    Jan 6, 2012
  5. Daedalous
    Replies:
    3
    Views:
    682
    Daedalous
    Jan 16, 2004
Loading...

Share This Page