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

M

Marco Snoek

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
 
L

Lasse Reichstein Nielsen

Marco Snoek said:
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
 
M

Marco Snoek

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:[email protected]...
 
L

Lasse Reichstein Nielsen

Marco Snoek said:
parent.frames[layername].test('123');
worked all right!!

Ah, so "layername" *is* a variable, sowas incorrect in using it as a string!

/L
 
M

Marco Snoek

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:[email protected]...
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:[email protected]...
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top