...

View Full Version : innerHTML of Iframe in parent



agentforsythe
09-03-2006, 07:12 PM
I have a page, with 3 IFRAMEs on it. From one of these IFRAMES, i am trying to append to the content of another IFRAME.

This doesnt work:
top.frames[0].document.getElementByID('chat').innerHTML+= "new content"

any thoughts?

I know I'm referring to the right frame, because

top.frames[0].document.location.href = "someotherpage.html"

does work

probey20
09-15-2006, 08:56 PM
I'm not positive, but I don't think you can append content using innerHTML. I think it wipes out everything that was previously there. Another way to accomplish what you're wanting is to try this:


var strContent = top.frames[0].document.getElementByID('chat').innerHTML + "new content";
top.frames[0].document.getElementByID('chat').innerHTML = strContent;

Arty Effem
09-16-2006, 07:00 PM
I have a page, with 3 IFRAMEs on it. From one of these IFRAMES, i am trying to append to the content of another IFRAME.

This doesnt work:
top.frames[0].document.getElementByID('chat').innerHTML+= "new content"

any thoughts?

Any error messages in the console?
Does this code run at load time, or after all frames are definitely loaded?

Mr J
09-16-2006, 10:36 PM
You have a typo in this line, maybe thats the problem

top.frames[0].document.getElementByID('chat').innerHTML+= "new content"


top.frames[0].document.getElementById('chat').innerHTML+= "new content"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum