/

HTML / CSS / JavaScript Tutorial

JavaScript Document own method: write()

[this page | pdf | back links]

The write() method (when applied to the document object of the JavaScript DOM) writes HTML (which can include JavaScript code) to the document.

 

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 has the following syntax with the following parameters. It does not return any value.

 

document.write(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