Embeded JavaScript document.write's in Netscape 4.x

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

    Embeded JavaScript document.write's in Netscape 4.x

    When embedding a JavaScript document.write within a JavaScript
    document.write in Netscape 4.x (example below), the text is written
    out of logical order.

    <script type="text/javascript">
    <!--
    document.write( '<script
    type=\"text/javascript\">do cument.write(\' 111\');<\/script>222');
    document.write( '333');
    //-->
    </script>

    Netscape 4.x produces "111333 222". Notice the space between the
    elements and that the elements are not in order.

    The correct output should be "111222333" as produced by all versions
    of IE, Netscape 3.x and below, and Netscape 6.x and above.

    Has anyone run into this and/or found a solution to this issue?
    Please explain why this is happening and how I can fix/work-around it.

    I need embeded scripts.
    I need them to work in Netscape 4.x
    And I need them to be in one long document.write string so please
    don't ask me to seperate them.

    Thank you.

    Nickolaus Benjamin Padgett
    nick.padgett@tu rner.com
  • Dom Leonard

    #2
    Re: Embeded JavaScript document.write' s in Netscape 4.x

    nickolausp wrote:[color=blue]
    > When embedding a JavaScript document.write within a JavaScript
    > document.write in Netscape 4.x (example below), the text is written
    > out of logical order.
    >
    > <script type="text/javascript">
    > <!--
    > document.write( '<script
    > type=\"text/javascript\">do cument.write(\' 111\');<\/script>222');
    > document.write( '333');
    > //-->
    > </script>
    >
    > Netscape 4.x produces "111333 222". Notice the space between the
    > elements and that the elements are not in order.
    >[/color]
    <SNIP>

    Ensuring the embedded script tag is the last thing written by a single
    call to document.write seems to achieve correct rendering results when
    tested under NS 4.72. The corollary is that placing extra content after
    an embedded '<\/script>' end tag, or including extra parameters in the
    document write call to achieve the same result, produces predictable
    rendering failures under NS4.

    Any solution to an NS4 bug, however, needs to be tested against actual
    document structure and conditions in which it is expected to function.

    Good luck,
    Dom

    Comment

    Working...