Document write() Method - Javascript DOM

Javascript examples for DOM:Document write

Description

The write() method writes HTML expressions or JavaScript code to a document.

Syntax

document.write(exp1, exp2, exp3, ...);

Parameter Values

Parameter Description
exp1, exp2, exp3, ... Optional. arguments to be appended to the document in order of occurrence

Return Value:

No return value

The following code shows how to Write some text directly to the HTML document:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<pre>
<script>
document.write("Hello World!");
document.write("Have a nice day!");
</script>//from   ww  w. j  a v a 2  s .c o m
</pre>

</body>
</html>

Related Tutorials