/

HTML / CSS / JavaScript Tutorial

JavaScript Document own method: writeln()

[this page | pdf | back links]

The writeln() method (when applied to the document object of the JavaScript DOM) writes HTML (which can include JavaScript code) to the document, writing a newline character after each expression.

 

It is mostly used for testing, as if it is used after an HTML document is fully loaded it will delete the existing HTML. Alternatively, it may be used to write to a bespoke output stream opened by the document.open() method.

 

It is essentially the same as document.write() except that it adds a new line character after each statement.

 

It has the following syntax with the following parameters. It does not return any value.

 

document.writeln(expr1, expr2, expr3, )

 

Parameter

Required / Optional

Description

expr1, expr2, expr3,

Optional

Text written to output stream

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile