document.writeln
In this chapter you will learn:
Append to the end
document.writeln()
appends content
to the end of the HTML document.
<!DOCTYPE HTML> <!-- ja v a 2s. c o m-->
<html>
<body>
<p>
This is a test.
</p>
<script>
document.writeln("new added");
</script>
</body>
</html>
Output tags
The following code uses document.writeln()
to append tags.
<!DOCTYPE HTML> <!-- ja v a2 s .c o m-->
<html>
<body>
<p id="myText">
<span id="mySpan">HTML</span>
This is a test.
This is a test.
</p>
<script>
document.writeln("<pre>J ava 2s .com</pre>");
</script>
</body>
</html>
Next chapter...
What you will learn in the next chapter:
Home » Javascript Tutorial » Document