The dynamic modification of a document may be modeled as follows:
HTML documents are constrained to conform to the HTML DTD both before and after processing any SCRIPT elements.
The following example illustrates how scripts may modify a document dynamically. The following script:
 <TITLE>Test Document</TITLE>
 <SCRIPT type="text/javascript">
     document.write("<p><b>Hello World!<\/b>")
 </SCRIPT>
  Has the same effect as this HTML markup:
<TITLE>Test Document</TITLE> <P><B>Hello World!</B>