write to a different frame

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ray Schaeffer

    write to a different frame


    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

  • Lasse Reichstein Nielsen

    #2
    Re: write to a different frame

    Ray Schaeffer <redrock1@cox.n et> writes:
    [color=blue]
    > 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[/color]

    The "loading" state stays until you close the document again
    (i.e., "parent.fra mes['frame1'].document.close ()").
    [color=blue]
    > 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.[/color]

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

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

    /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

    • Ray Schaeffer

      #3
      Re: write to a different frame


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

      Lasse Reichstein Nielsen wrote:[color=blue]
      > Ray Schaeffer <redrock1@cox.n et> writes:
      >
      >[color=green]
      >>I've written a very simple test HTML/JS program where
      >>the JS code in one frame writes to a different frame with
      >>"parent.frame 1.document.writ e(...".
      >>This seems to work ok with IE-6, but with NS-7, after the
      >>first write, the "loading" seems to loop forever[/color]
      >
      >
      > The "loading" state stays until you close the document again
      > (i.e., "parent.fra mes['frame1'].document.close ()").[/color]

      If you close, to stop the loading, it appears that you cannot
      write to it again.
      [color=blue]
      >
      >[color=green]
      >>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.[/color]
      >
      >
      > How "not work". What does the javascript console say?[/color]

      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: "...undocumente d error..."
      [color=blue]
      >
      >[color=green]
      >>Both NS and IE seem to perform the write slowly, and in multiple
      >>writes in rapid succession, some will be dropped.[/color]
      >
      >
      > Weird, but that's all I can say without seeing the code.
      >
      > /L[/color]

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

      <table border=1 cellpadding=3 bgcolor="#5cace e">
      <!-- Buttons -->
      <tr bgcolor="#5cace e">
      <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>

      Comment

      • Ray Schaeffer

        #4
        Re: write to a different frame


        Here is the error
        =============== ==
        Error: uncaught exception: [Exception... "Component returned failure code:
        0x80004001 (NS_ERROR_NOT_I MPLEMENTED)
        [nsIEditorShell. GetSelectedOrPa rentTableElemen t]" nsresult: "0x80004001
        (NS_ERROR_NOT_I MPLEMENTED)" location: "JS frame ::
        chrome://editor/content/editor.js :: goUpdateTableMe nuItems :: line 2463" data: no]
        =============== =

        Thanks

        Lasse Reichstein Nielsen wrote:[color=blue]
        > Ray Schaeffer <redrock1@cox.n et> writes:
        >
        >[color=green]
        >>I've written a very simple test HTML/JS program where
        >>the JS code in one frame writes to a different frame with
        >>"parent.frame 1.document.writ e(...".
        >>This seems to work ok with IE-6, but with NS-7, after the
        >>first write, the "loading" seems to loop forever[/color]
        >
        >
        > The "loading" state stays until you close the document again
        > (i.e., "parent.fra mes['frame1'].document.close ()").
        >
        >[color=green]
        >>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.[/color]
        >
        >
        > How "not work". What does the javascript console say?
        >
        >[color=green]
        >>Both NS and IE seem to perform the write slowly, and in multiple
        >>writes in rapid succession, some will be dropped.[/color]
        >
        >
        > Weird, but that's all I can say without seeing the code.
        >
        > /L[/color]

        Comment

        • Lasse Reichstein Nielsen

          #5
          Re: write to a different frame

          Ray Schaeffer <redrock1@cox.n et> writes:
          [color=blue]
          > If you close, to stop the loading, it appears that you cannot
          > write to it again.[/color]

          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.a ppendChild(othe rDoc.createText Node("Hello"));
          [color=blue]
          > a. "not work" = nothing written[/color]

          I can see the problem in Mozilla.
          [color=blue]
          > b. I have gotten the JS console to give errors, but not can not make
          > it repeatable. The error is somthing like: "...undocumente d error..."[/color]

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

          Comment

          Working...