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

RE: accessing frame element?

From: Rowland Shaw <Rowland.Shaw@crystaldecisions.com>
Date: Mon, 11 Feb 2002 01:30:25 -0800
Message-ID: <963A03BCAFF059488BAFF33AE5C8709707FFF3@IPSENT04>
To: "'alex'" <shortestpath@yahoo.com>, www-dom@w3.org

-----Original Message-----
From: alex [mailto:shortestpath@yahoo.com]

> 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);
> </script>

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

Assuming "rame2" was a typo...

If you're running your script in frame1; I'd not expect gEBI to return the
id of the other frame, as it's not in the document(!); Instead, it's in the
parent document.

My first choice would be to use the window.frames collection (although I
forget how cross browser safe it is) or even using
window.document.getElementById() (Theory goes that by qualifying *which*
document object you want to play with, will work.)
Received on Monday, 11 February 2002 04:40:15 UTC

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