write to a different frame

Discussion in 'Javascript' started by Ray Schaeffer, Sep 19, 2003.

  1. Hi,

    I've written a very simple test HTML/JS program where
    the JS code in one frame writes to a different frame with
    "parent.frame1.document.write(...".
    This seems to work ok with IE-6, but with NS-7, after the
    first write, the "loading" seems to loop forever and if you
    click on "stop", the write will not work anymore. Also in
    NS, if you push reload, the write will not work anymore.
    Both NS and IE seem to perform the write slowly, and in
    multiple writes in rapid succession, some will be dropped.

    Can someone help ?

    Thanks
    Ray
     
    Ray Schaeffer, Sep 19, 2003
    #1
    1. Advertising

  2. Ray Schaeffer <> writes:

    > I've written a very simple test HTML/JS program where
    > the JS code in one frame writes to a different frame with
    > "parent.frame1.document.write(...".
    > This seems to work ok with IE-6, but with NS-7, after the
    > first write, the "loading" seems to loop forever


    The "loading" state stays until you close the document again
    (i.e., "parent.frames['frame1'].document.close()").

    > and if you click on "stop", the write will not work anymore.
    > Also in NS, if you push reload, the write will not work anymore.


    How "not work". What does the javascript console say?

    > Both NS and IE seem to perform the write slowly, and in multiple
    > writes in rapid succession, some will be dropped.


    Weird, but that's all I can say without seeing the code.

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Sep 19, 2003
    #2
    1. Advertising

  3. Thanks for the reply
    The code is below and comments interspersed.

    Lasse Reichstein Nielsen wrote:
    > Ray Schaeffer <> writes:
    >
    >
    >>I've written a very simple test HTML/JS program where
    >>the JS code in one frame writes to a different frame with
    >>"parent.frame1.document.write(...".
    >>This seems to work ok with IE-6, but with NS-7, after the
    >>first write, the "loading" seems to loop forever

    >
    >
    > The "loading" state stays until you close the document again
    > (i.e., "parent.frames['frame1'].document.close()").


    If you close, to stop the loading, it appears that you cannot
    write to it again.

    >
    >
    >>and if you click on "stop", the write will not work anymore.
    >>Also in NS, if you push reload, the write will not work anymore.

    >
    >
    > How "not work". What does the javascript console say?


    a. "not work" = nothing written
    b. I have gotten the JS console to give errors, but not can not make
    it repeatable. The error is somthing like: "...undocumented error..."

    >
    >
    >>Both NS and IE seem to perform the write slowly, and in multiple
    >>writes in rapid succession, some will be dropped.

    >
    >
    > Weird, but that's all I can say without seeing the code.
    >
    > /L


    ==== Parent =======================================================
    <HTML>
    <HEAD><TITLE>Frames Example</TITLE></HEAD>
    <!-- divide into columns -->
    <!-- 1st = 50 % -->
    <!-- 2nd = whatever is left over -->
    <FRAMESET COLS="50%,*">
    <FRAME SRC="frame1.html" NAME="frame1">
    <FRAME SRC="frame2.html">
    </FRAMESET>
    <BODY>
    </BODY>
    </HTML>
    ==== frame1.html ==================================================
    <HTML>
    <HEAD><TITLE>Frames Example</TITLE></HEAD>
    <BODY>
    </BODY>
    </HTML>
    ==== frame2.html ==================================================
    <HTML>
    <HEAD><TITLE>Frames Example</TITLE></HEAD>
    <BODY>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- hide from old browsers
    //
    function doit()
    {
    //parent.frame1.document.open();
    parent.frame1.document.write("Hello<br>");
    //parent.frame1.document.close();
    //alert("done");
    }
    //
    // end script hiding -->
    </SCRIPT>
    Frame 2 text<BR>
    Hello<BR>

    <table border=1 cellpadding=3 bgcolor="#5cacee">
    <!-- Buttons -->
    <tr bgcolor="#5cacee">
    <form NAME="roundit">
    <td> <font face=arial size=-1> <b> <p align="center">Rounding</p> </b>
    </font>
    </td>
    <td>
    <p align="center"><input TYPE="text" NAME="roundval" SIZE=1> </p>
    </td>
    <td>
    <p align="center"><input TYPE="button" VALUE=" Set "
    Onclick="doit()"></p>
    </td>
    </form>
    </tr>
    </table>
    </BODY>
    </HTML>
     
    Ray Schaeffer, Sep 20, 2003
    #3
  4. Here is the error
    =================
    Error: uncaught exception: [Exception... "Component returned failure code:
    0x80004001 (NS_ERROR_NOT_IMPLEMENTED)
    [nsIEditorShell.GetSelectedOrParentTableElement]" nsresult: "0x80004001
    (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame ::
    chrome://editor/content/editor.js :: goUpdateTableMenuItems :: line 2463" data: no]
    ================

    Thanks

    Lasse Reichstein Nielsen wrote:
    > Ray Schaeffer <> writes:
    >
    >
    >>I've written a very simple test HTML/JS program where
    >>the JS code in one frame writes to a different frame with
    >>"parent.frame1.document.write(...".
    >>This seems to work ok with IE-6, but with NS-7, after the
    >>first write, the "loading" seems to loop forever

    >
    >
    > The "loading" state stays until you close the document again
    > (i.e., "parent.frames['frame1'].document.close()").
    >
    >
    >>and if you click on "stop", the write will not work anymore.
    >>Also in NS, if you push reload, the write will not work anymore.

    >
    >
    > How "not work". What does the javascript console say?
    >
    >
    >>Both NS and IE seem to perform the write slowly, and in multiple
    >>writes in rapid succession, some will be dropped.

    >
    >
    > Weird, but that's all I can say without seeing the code.
    >
    > /L
     
    Ray Schaeffer, Sep 20, 2003
    #4
  5. Ray Schaeffer <> writes:

    > If you close, to stop the loading, it appears that you cannot
    > write to it again.


    You can, but when you do, you open the document again, which
    clears it. So the old line is erased, and a new, identical, line
    is written.

    Document.write is only meant for using while a document is being
    loaded. That is why an opend document triggers the "loading" icon
    stat in Mozilla/Netscape. There is no way to avoid this if you use
    document.write to write the data to the new page.

    Alternatives are using .innerHTML or DOM (where I prefer DOM):

    var otherDoc = parent.frames['frame1'].document;
    otherDoc.body.appendChild(otherDoc.createTextNode("Hello"));

    > a. "not work" = nothing written


    I can see the problem in Mozilla.

    > b. I have gotten the JS console to give errors, but not can not make
    > it repeatable. The error is somthing like: "...undocumented error..."


    I can't reproduce that, though. I am using Mozilla 1.5a (or usually
    Mozilla Firebird 0.6). I don't get lost lines, slow writing or funny
    error messages, so I can't help you with that.

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Sep 20, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Søren M. Olesen
    Replies:
    0
    Views:
    583
    Søren M. Olesen
    Nov 13, 2003
  2. Microsoft
    Replies:
    3
    Views:
    701
    Hugo Wetterberg
    Oct 4, 2004
  3. Jim Mesara
    Replies:
    0
    Views:
    136
    Jim Mesara
    Aug 27, 2003
  4. Arvin Portlock
    Replies:
    4
    Views:
    283
    Arvin Portlock
    Jul 12, 2004
  5. Rob Gordon

    Breaking a frame from a different frame

    Rob Gordon, Oct 17, 2004, in forum: Javascript
    Replies:
    0
    Views:
    139
    Rob Gordon
    Oct 17, 2004
Loading...

Share This Page