Document.writeln() (Method)

A method for writing HTML into the document body.


DOM level - 1
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
JavaScript syntax:-myDocument.writeln(anArgument)
-myDocument.writeln(anArgument, ...)
Argument list:anArgumentA value to be written out to the document

The document.writeln() method is very similar to the document.write() method. The difference is that document.writeln() will place a carriage return after the written value.

This is of little consequence when writing HTML because the browser ignores any line breaks in the HTML.

However, it can be useful when writing other kinds of output such as plain text for example.

The DOM level 1 specification suggests that this method may be deprecated in the future.

See also:Comma operator (,), Document object, Document.close(),, Input-output, response.write()