hg*******@calidris.com (Halldór Ísak Gylfason) writes:
basically I have an IFrame inside the top frame. The document in
IFrame defines a javascript object:
var a = new Table();
I assume that is a global variable of the IFrame document. That
is, it is a property of its window object.
in the top level frame I want to access this object. I tried doing
document.getElementById("IFrameId").document.a
but that didn't work. By the way, I am using IE.
In IE, you can write
document.getElementById("IFrameID").contentWindow. a
That won't work in all browsers, though. There is no standard that
includes contentWindow. The DOM HTML specification only describe
documents, so it has a ".contentDocument" property, but it won't allow
you to access a global variable of the iframe.
A more portable method is
frames["IFrameID"].a
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'