Document.write is a method of writing simple text using javascript.


Document.write simply prints the specified text to the page. To print text, enter the text in single quote marks inside parentheses like so:

 document.write('Hello World!');

Document.write can also be used to show variables like so:

 var mytext = "Hello again";

Note that if quote marks are placed around the variable name, the variable name itself will be printed (instead of the variable value).

Community content is available under CC-BY-SA unless otherwise noted.