Best way to write to another frame?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mikko Tussunen

    #1

    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.getEl ementById('msgd iv').innerHTML +=
    content;

    May explanation may have been insufficient, please tell me if it was.


  • Lasse Reichstein Nielsen

    #2
    Re: Best way to write to another frame?

    "Mikko Tussunen" <afae@faef.co m> writes:
    [color=blue]
    > I wonder, what would be the best way to write content to another frame?
    > Meaning that as many browsers as possible supports it.[/color]
    [color=blue]
    > 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.[/color]

    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.
    [color=blue]
    > I've tried
    >
    > document.parent['framename'].document.write ('TEXT'); (I believe I had some
    > problems with this in mozilla)[/color]

    Try
    parent.frames['framename'].document.write ('TEXT');
    [color=blue]
    > document.parent['framename'].document.getEl ementById('msgd iv').innerHTML +=
    > content;[/color]

    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 - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...