using variable to address (function in) other frame..

Discussion in 'Javascript' started by Marco Snoek, Sep 30, 2003.

  1. Marco Snoek

    Marco Snoek Guest

    Hya,

    Think it's a simple question:

    on a page I have a couple of IFRAME's loaded on top of each other, only one
    visible.
    With a simple:

    parent.document.getElementById("layername").style.visibility

    I can easily make swith between the diffrent iframes with 'visible' /
    'hidden'..
    Now.. After making a iframe visible, I have to trigger a function _inside_
    the iframe, to check if the content has to be reloaded / refreshed..
    But:

    parent.layername.check('123');

    returns an error saying layername doesn't exist...
    How can I make javascript understand layername is a variable..???...???

    Thanx in advance,
    Marco Snoek
     
    Marco Snoek, Sep 30, 2003
    #1
    1. Advertising

  2. "Marco Snoek" <[mps]@DONT _ YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> writes:

    > on a page I have a couple of IFRAME's loaded on top of each other, only one
    > visible.
    > With a simple:
    >
    > parent.document.getElementById("layername").style.visibility
    >
    > I can easily make swith between the diffrent iframes with 'visible' /
    > 'hidden'..


    That code is executed inside one of the iframes, right?

    > Now.. After making a iframe visible, I have to trigger a function
    > _inside_ the iframe, to check if the content has to be reloaded /
    > refreshed.. But:
    >
    > parent.layername.check('123');
    >
    > returns an error saying layername doesn't exist...
    > How can I make javascript understand layername is a variable..???...???


    Are you sure it *is* a variable? How is the name "layername" attached
    to the iframe, with the "id" or "name" attribute (I would use "name")?
    Which browser do you use?

    If the code is executed in the same iframe as the first line, I would write:

    parent.frames['layername'].check('123');

    It should work. It does in the example here (using the name attribute
    for the iframe):
    <URL:file://localhost/D:/Home/lrn/html/faq/JSwindows.html#ref_3_12>

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Sep 30, 2003
    #2
    1. Advertising

  3. Marco Snoek

    Marco Snoek Guest

    Great!!!!!

    That was the trick!!
    parent.frames[layername].test('123');
    worked all right!!

    (Use IE6 btw)

    Thanx Lasse!!!!



    "Marco Snoek" <[mps]@DONT _
    YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> schreef in
    bericht news:3f792e5c$0$58708$4all.nl...
    > Hya,
    >
    > Think it's a simple question:
    >
    > on a page I have a couple of IFRAME's loaded on top of each other, only

    one
    > visible.
    > With a simple:
    >
    > parent.document.getElementById("layername").style.visibility
    >
    > I can easily make swith between the diffrent iframes with 'visible' /
    > 'hidden'..
    > Now.. After making a iframe visible, I have to trigger a function _inside_
    > the iframe, to check if the content has to be reloaded / refreshed..
    > But:
    >
    > parent.layername.check('123');
    >
    > returns an error saying layername doesn't exist...
    > How can I make javascript understand layername is a variable..???...???
    >
    > Thanx in advance,
    > Marco Snoek
    >
    >
     
    Marco Snoek, Sep 30, 2003
    #3
  4. "Marco Snoek" <[mps]@DONT _ YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> writes:

    > parent.frames[layername].test('123');
    > worked all right!!


    Ah, so "layername" *is* a variable, so
    > > parent.document.getElementById("layername").style.visibility

    was incorrect in using it as a string!

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Sep 30, 2003
    #4
  5. Marco Snoek

    Marco Snoek Guest

    Yes, getElementById("layername") was wrong....

    well spotted :))

    Marco

    "Marco Snoek" <[mps]@DONT _
    YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> schreef in
    bericht news:3f793553$0$58706$4all.nl...
    > Great!!!!!
    >
    > That was the trick!!
    > parent.frames[layername].test('123');
    > worked all right!!
    >
    > (Use IE6 btw)
    >
    > Thanx Lasse!!!!
    >
    >
    >
    > "Marco Snoek" <[mps]@DONT _
    > YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> schreef in
    > bericht news:3f792e5c$0$58708$4all.nl...
    > > Hya,
    > >
    > > Think it's a simple question:
    > >
    > > on a page I have a couple of IFRAME's loaded on top of each other, only

    > one
    > > visible.
    > > With a simple:
    > >
    > > parent.document.getElementById("layername").style.visibility
    > >
    > > I can easily make swith between the diffrent iframes with 'visible' /
    > > 'hidden'..
    > > Now.. After making a iframe visible, I have to trigger a function

    _inside_
    > > the iframe, to check if the content has to be reloaded / refreshed..
    > > But:
    > >
    > > parent.layername.check('123');
    > >
    > > returns an error saying layername doesn't exist...
    > > How can I make javascript understand layername is a variable..???...???
    > >
    > > Thanx in advance,
    > > Marco Snoek
    > >
    > >

    >
    >
     
    Marco Snoek, Sep 30, 2003
    #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. Raterus
    Replies:
    0
    Views:
    451
    Raterus
    Jun 2, 2004
  2. S?ren Gammelmark
    Replies:
    1
    Views:
    1,928
    Eric Sosman
    Jan 7, 2005
  3. Replies:
    2
    Views:
    201
  4. Jim Cobban
    Replies:
    0
    Views:
    127
    Jim Cobban
    Jul 31, 2005
  5. Rob
    Replies:
    11
    Views:
    224
Loading...

Share This Page