Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > using variable to address (function in) other frame..

Reply
Thread Tools

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

 
 
Marco Snoek
Guest
Posts: n/a
 
      09-30-2003
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


 
Reply With Quote
 
 
 
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      09-30-2003
"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.'
 
Reply With Quote
 
 
 
 
Marco Snoek
Guest
Posts: n/a
 
      09-30-2003
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$...
> 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
>
>



 
Reply With Quote
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      09-30-2003
"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.'
 
Reply With Quote
 
Marco Snoek
Guest
Posts: n/a
 
      09-30-2003
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$...
> 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$...
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
Function pointers, variable argument functions calling other variable-argument functions (sort of) S?ren Gammelmark C Programming 1 01-07-2005 09:41 PM
Name of variable is value of other variable Bart Van der Donck Perl Misc 12 09-11-2004 09:03 PM
address array by variable variable mps@webmind.nl Javascript 9 07-20-2004 06:48 AM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57