Best way to write to another frame?

M

Mikko Tussunen

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.
 
L

Lasse Reichstein Nielsen

Mikko Tussunen said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top