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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marco Snoek

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

    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").s tyle.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.layernam e.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


  • Lasse Reichstein Nielsen

    #2
    Re: using variable to address (function in) other frame..

    "Marco Snoek" <[mps]@DONT _ YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> writes:
    [color=blue]
    > 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").s tyle.visibility
    >
    > I can easily make swith between the diffrent iframes with 'visible' /
    > 'hidden'..[/color]

    That code is executed inside one of the iframes, right?
    [color=blue]
    > 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.layernam e.check('123');
    >
    > returns an error saying layername doesn't exist...
    > How can I make javascript understand layername is a variable..???.. .???[/color]

    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 - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Marco Snoek

      #3
      Re: using variable to address (function in) other frame..

      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$e4fe514c @news.xs4all.nl ...[color=blue]
      > Hya,
      >
      > Think it's a simple question:
      >
      > on a page I have a couple of IFRAME's loaded on top of each other, only[/color]
      one[color=blue]
      > visible.
      > With a simple:
      >
      > parent.document .getElementById ("layername").s tyle.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.layernam e.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
      >
      >[/color]


      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: using variable to address (function in) other frame..

        "Marco Snoek" <[mps]@DONT _ YOU^DARE%SEND/SPAM!!!@remove/this[@webmind.nl]@remove/this> writes:
        [color=blue]
        > parent.frames[layername].test('123');
        > worked all right!![/color]

        Ah, so "layername" *is* a variable, so[color=blue][color=green]
        > > parent.document .getElementById ("layername").s tyle.visibility[/color][/color]
        was incorrect in using it as a string!

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Marco Snoek

          #5
          Re: using variable to address (function in) other frame..

          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$e4fe514c @news.xs4all.nl ...[color=blue]
          > 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$e4fe514c @news.xs4all.nl ...[color=green]
          > > Hya,
          > >
          > > Think it's a simple question:
          > >
          > > on a page I have a couple of IFRAME's loaded on top of each other, only[/color]
          > one[color=green]
          > > visible.
          > > With a simple:
          > >
          > > parent.document .getElementById ("layername").s tyle.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[/color][/color]
          _inside_[color=blue][color=green]
          > > the iframe, to check if the content has to be reloaded / refreshed..
          > > But:
          > >
          > > parent.layernam e.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
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...