This section provides a quick description of the document.write() method and a simple tutorial example of using the document.write() method.
As can see from the sample JavaScript in the previous section,
the "document.write(string)" method is a very useful method. Here are some notes about this method:
"document" is a built-in object representing the HTML document where the JavaScript is embedded in.
"write(string)" is a method provided by the "document" object. It writes the specified string
into the HTML document represented by the "document" object.
You can use the "document.write(string)" method to write anything, including HTML tags, into the HTML document.
Here is a tutorial example that shows you how to use the document.write() method to write
a large section of a HTML document:
<html>
<!-- Document_Write.html
Copyright (c) 2008 by Dr. Herong Yang, http://www.herongyang.com/
-->
<head><title>The document.write() Method</title></head>
<body>
<script type="text/javascript">
document.write('<center>');
document.write('Summer summer oh so hot,<br/>');
document.write('Summer summer trapped in a pot.<br/>');
document.write('When I open the lid I let you out,<br/>');
document.write('You make me so happy<br/>');
document.write('I want to shout!<br/>');
document.write('</center>');
</script>
</body>
</html>