By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,655 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Best way to write to another frame?

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
"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.