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

N

nickolausp

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
(e-mail address removed)
 
D

Dom Leonard

nickolausp said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top