Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-03-2006, 07:12 PM   PM User | #1
agentforsythe
New to the CF scene

 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
agentforsythe is an unknown quantity at this point
innerHTML of Iframe in parent

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
agentforsythe is offline   Reply With Quote
Old 09-15-2006, 08:56 PM   PM User | #2
probey20
New Coder

 
Join Date: Aug 2006
Location: Illinois
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
probey20 is an unknown quantity at this point
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:

Code:
var strContent = top.frames[0].document.getElementByID('chat').innerHTML + "new content";
top.frames[0].document.getElementByID('chat').innerHTML = strContent;
__________________
Sarah
probey20 is offline   Reply With Quote
Old 09-16-2006, 07:00 PM   PM User | #3
Arty Effem
Banned

 
Join Date: May 2006
Location: England
Posts: 664
Thanks: 0
Thanked 84 Times in 84 Posts
Arty Effem can only hope to improve
Quote:
Originally Posted by agentforsythe View Post
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?
Arty Effem is offline   Reply With Quote
Old 09-16-2006, 10:36 PM   PM User | #4
Mr J
Senior Coder

 
Join Date: Aug 2002
Location: UK
Posts: 2,789
Thanks: 2
Thanked 14 Times in 14 Posts
Mr J is on a distinguished road
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"
__________________
The silent one.

The most dangerous thing in the world is an idea.
The most dangerous person in the world is the one with an idea.
Mr J is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:11 PM.


Advertisement
Log in to turn off these ads.