Filling Your Windows II: The document Object

A second way of specifying content for new windows—or for your original Web browser window, for that matter—is by using methods of the document object. The following document object methods are used to create content within an XHTML document:

  • document.open()— The open() method is used to open the document for writing. If the method is used within an existing Web page, the content created will replace the current contents.

  • document.write() or document.writeln()— Each of these methods is used to write XHTML code into the currently opened document. If these statements are encountered while the current document is being loaded—in the following example, the document is already open—the content they generate ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.