Fandom

JavaScript Wiki

Document.write

87pages on
this wiki
Add New Page
Talk0 Share

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

TutorialEdit

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).

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.