Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM writeln() method

HTML DOM writeln() method

Document Object Reference Document Object


Definition and Usage

The writeln() method works the same as the write() method, plus it writes a newline character after each expression.

Syntax

document.writeln(

exp1,exp2,exp3,...

)

Parameters Description
exp1,exp2,exp3,... Optional. The output stream to write to. They will be appended to the document in order.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the writeln() method


Example

Example

The difference between write() and writeln():

Note that write() does NOT add a new line after each statement:


  



Note that writeln() add a new line after each statement:


  



Try it »


Document Object Reference Document Object