Use document.writeln() to append tags in JavaScript
Description
The following code shows how to use document.writeln() to append tags.
Example
<!-- ww w. ja va 2 s. c o m-->
<!DOCTYPE HTML>
<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>
The code above generates the following result.
Javascript Tutorial Operation
Append content to the end of the HTML docum...
Change the document title in JavaScript
Check if the document object has the queryS...
Delete all cookies by setting the expire da...
Navigate to the new URL and make an entry i...
Query HTML document using CSS selector in J...
Set new hash for a page in JavaScript
Append content to the end of the HTML docum...
Change the document title in JavaScript
Check if the document object has the queryS...
Delete all cookies by setting the expire da...
Navigate to the new URL and make an entry i...
Query HTML document using CSS selector in J...
Set new hash for a page in JavaScript