Definition and Usage
The write() method writes HTML expressions or JavaScript code to a document.
Syntax
document.write(exp1,exp2,exp3,...) |
Parameter | Description |
---|---|
exp1,exp2,exp3,... | Optional. What to write to the output stream. Multiple arguments can be listed and they will be appended to the document in order of occurrence |
Browser Support
The write() method is supported in all major browsers.
Examples
Example 1Write some text to the output stream:
Try it yourself » |
Example 2Write some formatted text to the output stream:
Try it yourself » |
Example 3Difference between write() and writeln():
Try it yourself » |