471,055 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,055 software developers and data experts.

Best way to write to another frame?

I wonder, what would be the best way to write content to another frame?
Meaning that as many browsers as possible supports it.

I have a frame that reloads with a 3 second interval, and depending on if
the user has entered information in a database (chat messages), it writes
the content to another frame. The content it has written before should be
visible.

I've tried

document.parent['framename'].document.write('TEXT'); (I believe I had some
problems with this in mozilla)

document.parent['framename'].document.getElementById('msgdiv').innerHTML +=
content;

May explanation may have been insufficient, please tell me if it was.
Jul 20 '05 #1
1 6977
"Mikko Tussunen" <af**@faef.com> writes:
I wonder, what would be the best way to write content to another frame?
Meaning that as many browsers as possible supports it. I have a frame that reloads with a 3 second interval, and depending on if
the user has entered information in a database (chat messages), it writes
the content to another frame. The content it has written before should be
visible.
The last part is a problem. You can get around it with programming,
but it is not immediate. When you have closed the document, writing to
it will erase the previous content, and you should close the document
to make sure that it is displayed correctly.
I've tried

document.parent['framename'].document.write('TEXT'); (I believe I had some
problems with this in mozilla)
Try
parent.frames['framename'].document.write('TEXT');
document.parent['framename'].document.getElementById('msgdiv').innerHTML +=
content;


innerHTML sure isn't the best method if you want as many browsers as
possible to understand it.

To keep the old content, you can store it as a property of the frame
object after writing it to the document. Then, before writing new
content, you read it back, append the new content, document.write it
and store it in the frame again.

/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.'
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bilbo | last post: by
3 posts views Thread by Microsoft | last post: by
1 post views Thread by Just D. | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.