W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Re: accessing frame element?

From: Johnny Stenback <jst@netscape.com>
Date: Fri, 08 Feb 2002 20:25:38 -0800
Message-ID: <3C64A4C2.4080609@netscape.com>
To: alex <shortestpath@yahoo.com>
CC: www-dom@w3.org
alex wrote:
> I have 2 frames in an html page. I've given
> id's to each frame:
> <frame id="frame1" ....
> <frame id="frame2" ....
> frame1 contains links, and frame2 is the target.
> I want to be able to tell when a new page has 
> loaded in frame2. Is this possible?
> I've tried a little test first just to see if
> I can even get to frame 2, and it seems I can't.
> I have within my <head> tags of my html page:
> <script language="javascript">
> alert(document.getElementById("rame2").id);

"rame2" should be "frame2", or is that just a typo in your email?

> </script>
> But this gives me an error. Is it possible to
> do what I've described?

Depending on the environment where this is run, you should be able to do 
what you tried above and once you find the iframe element you should be 
able to reach the document inside the iframe through the iframe 
element's .contentDocument property. This access might be blocked if 
you're dealing with cross domain access to these documents...

> thanks in advance,
> -alex
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com

Received on Friday, 8 February 2002 23:26:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC