How to append content the end of a HTML document
Append to the end
document.writeln()
appends content
to the end of the HTML document.
Example
<!DOCTYPE HTML>
<html>
<body>
<p>
This is a test.<!-- w w w. ja v a 2s . c o m-->
</p>
<script>
document.writeln("new added");
</script>
</body>
</html>
Output tags
The following code uses document.writeln()
to append tags.
<!DOCTYPE HTML>
<html>
<body>
<p id="myText">
<span id="mySpan">HTML</span>
This is a test.<!-- www .j ava2s . c om-->
This is a test.
</p>
<script>
document.writeln("<pre>J ava 2s .com</pre>");
</script>
</body>
</html>