Page 1 of 1

accessing IFrame innerHtml

Posted: Thu Jun 01, 2006 10:02 am
by mzfp2
Hi

I am having great trouble accessing the innerHTML (and changing it) for a IFrame on my page, using JavaScript.

Nothing seems to work in IE (I have managed to get it working in Firefox)

Can anyone help?

Posted: Thu Jun 01, 2006 10:05 am
by feyd
post your code.

Posted: Thu Jun 01, 2006 10:05 am
by Weirdan
What you've done so far?

Posted: Thu Jun 01, 2006 11:14 am
by mzfp2
Thaks for your replies,

I am using the following line of code

document.getElementById('rte1').contentWindow.document.body.innerHTML='Hello World';

However, instead of updating the Iframe's html content to read 'Hello World' a blank document replaces the current document, with the Hello World as the Text.

Iframe id is set to rte1.

Kind Regards

Posted: Thu Jun 01, 2006 11:20 am
by PrObLeM
I'm pretty sure (If I understand you) what you want to do is not possible. You would need to change the location of the Iframe to change the content inside.

Maybe instead of using an IFrame use a div with overflow set to auto.

Posted: Thu Jun 01, 2006 11:22 am
by Weirdan
PrObLeM wrote:I'm pretty sure (If I understand you) what you want to do is not possible.
as long as the target document originates from the same server as parent, it's possible.