By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,380 Members | 1,736 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,380 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
ni**********@turner.com
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.