![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.javascript archiveRe: Accessing an IFrame's properties
From: Lasse Reichstein Nielsen <lrn@hotpop.com>
Date: Sun Apr 30 2006 - 23:44:11 CEST
Declan Naughton <piratepenguin@gmail.com> writes:
> Seeing as window.frames isn't a part of any w3c standard, surely there
Yes.
---
var iframeElem = document.getElementById("myIframeId");
var iframeDoc = iframeElem.contentDocument;
iframeDoc.body.style.backgroundColor="red"; // i'm in!
---
Does it work in IE? Ofcourse not.
In IE, iframe elements does not have a "contentDocument" property.
They do have a "contentWindow", so you can do:
---
var iframeDoc = iframeElem.contentDocument ||
(iframeElem.contentWindow && iframeElem.contentWindow.document);
---
Good luck.
/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Received on Mon May 1 05:28:24 2006
|