470,587 Members | 2,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,587 developers. It's quick & easy.

controlling an iframe from another iframe within a frame

I need to know how to change the src property of an iframe from script
that is executed in another iframe with both of these iframes being
contained on a document which is then contained by another frame. I
have done a bunch of searching on these groups all to no avail.
I am new to javascript and learning so if someone can help me with
this I would appreciate it.
Jul 23 '05 #1
1 1760
What you need to learn to do is navigate the document hierarchy, which is
pretty simple once you get the hang of it. It should also be noted that
unless you're willing to work with one browser and one browser only, you're
not going to enjoy all the coding that makes this cross-browser compatible.
For IE only, if I have an HTML file with an iFrame and I want to refer to
that iFrame, I do this:

document.myFrame.location = "http://www.yahoo.com"

If I want to refer back to the document from my iframe, I do this in the
iframe code:

parent.somesetting.somevalue = 'some new value'

To refer to a second iframe from the first iframe:

parent.secondIframe.location = "http://www.google.com"

To refer to the containing frame of the parent document of either iframe:

parent.parent.someSetting.value = 'some new value'

See how that works for you...

- Wm

--
William Morris
Product Development, Seritas LLC
Kansas City, Missouri

"James Wallace" <jw******@btutilities.com> wrote in message
news:a5**************************@posting.google.c om...
I need to know how to change the src property of an iframe from script
that is executed in another iframe with both of these iframes being
contained on a document which is then contained by another frame. I
have done a bunch of searching on these groups all to no avail.
I am new to javascript and learning so if someone can help me with
this I would appreciate it.

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jeff Thies | last post: by
3 posts views Thread by Lans Redmond | last post: by
6 posts views Thread by Phlip | last post: by
3 posts views Thread by Alexandre Jaquet | last post: by
4 posts views Thread by christine.nguyen | last post: by
3 posts views Thread by Angel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.