Iason

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromJuan Marí Escanellas
ToMe
Subjectobtaining reference to element in a document inside IFRAME
Date22 September 2004 12:13
In IE6 Frame also have a property Document with D capital you can get the
container of iframe like this:

document.getElementById(IdIframe).Document.getElementById(ElementID)

Juan Marí.
FromMe
ToJuan Marí Escanellas
SubjectRe: obtaining reference to element in a document inside IFRAME
Date22 September 2004 12:50
Juan,

urgh :D - yet more incompatible stuff

I will stick with
document.frames['framename'].window.document.getElementById(elementID)
since it works in everything that supports iframes.

I am aware of things like contentDocument, contentWindow, Document and
document, all of which can be properties of the iframe element, but since
using them requires cross browser object detection, I don't see much point
in using them.

But thanks for taking the time to let me know, I may add something to my
tutorial to say that these exist.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.