Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1752 Can JavaScript use newline characters to format the output?

irt.org | Knowledge Base | JavaScript | Text | Q1752 [ previous next ]

Q1752 Can JavaScript use newline characters to format the output?

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.