Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1752 Can JavaScript use newline characters to format the output?

You are here: irt.org | FAQ | JavaScript | Text | Q1752 [ previous next ]

Yes. Although if you do not use the pre tag the output will simply ignore the newline character. Try for example:

<pre>
<script language="JavaScript"><!--
document.write('1\n2\n3\n4\n5');
//--></script>
</pre>

or:

<pre>
<script language="JavaScript"><!--
document.writeln('1');
document.writeln('2');
document.writeln('3');
document.writeln('4');
document.writeln('5');
//--></script>
</pre>

©2018 Martin Webb