Re: Accesing an IFrame from an internal element
- From: Lasse Reichstein Nielsen <lrn@xxxxxxxxxx>
- Date: Thu, 23 Feb 2006 07:54:52 +0100
"Fernando Deutsch" <fdeutschnospam@xxxxxxxxxxxxxxx> writes:
Please don't top post!
May look as nonsense code to you, because you dont know the whole context of
the application.
More likely because he knows how the DOM works.
You wrote, e.g.:
element.window
and
element.ownerDocument.window
That's just blind guessing on your part, and it works as well as
could be expected from that. The element does have an "ownerDocument"
property (as specified by W3C DOM Core), but neither the document
nor the element has a reference to a window object.
So I am looking to see what object would be the "window container" of that
img . As I have a reference to the img object I can navigate to its owner
document, and from it, I should be able to reach its window (expecting the
iframe) but I got an undefined object.
The error is your assumption that you can go from a DOM element to
the window containing the DOM document of the element. The window object
is not a DOM object, so the DOM specification doesn't say how to find
it.
You might be able to use document.defaultView, as some browsers have
that property point to the window object. It is not specified that the
defaultView should also be the global object, or a window object, and
it's not available in all browsers, so it's not a good solution.
According to the Mozilla Document Interface
http://www.mozilla.org/docs/dom/domref/dom_doc_ref.html#998664 I should be
able to get the window by the property contentWindow.
That's a property on the DOM element of the iframe in the parent document,
not on an element in the window you want to find.
You could also just do (in the parent window):
frames["iframeId"]
to get the window object of the embedded iframe with id="iframeId".
/L
--
Lasse Reichstein Nielsen - lrn@xxxxxxxxxx
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
.
- Follow-Ups:
- Re: Accesing an IFrame from an internal element
- From: Csaba Gabor
- Re: Accesing an IFrame from an internal element
- References:
- Accesing an IFrame from an internal element
- From: Fernando Deutsch
- Re: Accesing an IFrame from an internal element
- From: Evertjan.
- Re: Accesing an IFrame from an internal element
- From: Fernando Deutsch
- Re: Accesing an IFrame from an internal element
- From: Evertjan.
- Re: Accesing an IFrame from an internal element
- From: Fernando Deutsch
- Accesing an IFrame from an internal element
- Prev by Date: pull out data by pressing tab
- Next by Date: Re: pull out data by pressing tab
- Previous by thread: Re: Accesing an IFrame from an internal element
- Next by thread: Re: Accesing an IFrame from an internal element
- Index(es):
Relevant Pages
|