Document write() Method - Difference between write() and writeln(): - Javascript DOM

Javascript examples for DOM:Document write

Description

Document write() Method - Difference between write() and writeln():

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 w w  w .j  av a2 s.  c o  m
</pre>

<p>Note that writeln() add a new line after each statement:</p>

<pre>
<script>
document.writeln("Hello World!");
document.writeln("Have a nice day!");
</script>
</pre>

</body>
</html>

Related Tutorials