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

Discussion in 'Javascript' started by nickolausp, Jul 17, 2003.

  1. nickolausp

    nickolausp Guest

    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\">document.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
    nickolausp, Jul 17, 2003
    #1
    1. Advertising

  2. nickolausp

    Dom Leonard Guest

    nickolausp wrote:
    > 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\">document.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.
    >

    <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
    Dom Leonard, Jul 18, 2003
    #2
    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. Sunny
    Replies:
    2
    Views:
    521
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Mar 21, 2007
  2. Yvan J. Gagnon
    Replies:
    4
    Views:
    99
  3. Dave
    Replies:
    9
    Views:
    184
    thrill5
    Feb 21, 2006
  4. Replies:
    2
    Views:
    78
  5. Frank Peterson
    Replies:
    9
    Views:
    218
    David Mark
    Jun 28, 2009
Loading...

Share This Page