JavaScript Wiki

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

Tutorial[]

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";
 document.write(mytext);

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