Active Client Pages: Chrys`s Approach - DOM Properties and Methods to Use
(Page 4 of 4 )
We shall use the DOM Document object. Each page is a DOM document object.
Document Object Properties
cookie | Sets or returns all cookies associated with the current document |
Document Object Methods
open() | Opens a stream to collect the output from any document.write() or document.writeln() methods. |
close() | Closes an output stream opened with the document.open() method, and displays the collected data. |
write() | Writes HTML expressions or JavaScript code to a document. |
writeln() | Identical to the write() method, with the addition of writing a new line character after each expression. |
We shall not use the writeln() method in this series. If you want more information on the write() and writeln() methods, then wait for an article that I will write on that. In that article I will say a lot about when, where and how to use these two methods. I will give you some explanation of the write method as we go along.
The Document Open Method
The document open method is a very important method in this series. Do not confuse this with the window open method. I will talk about the window open method when we deal with the next (window) phase of my approach. Let us now look at the document open method in more detail. We look at its syntax and parameters.
Syntax
The syntax is:
document.open(mimetype,replace)
The "document" here refers to the current document. It returns a reference to the document (page) opened. If a document already exists in the target, it will be cleared. If this method has no arguments, a new window with about:blank is displayed.
Parameter | Description |
mimetype | Optional. Specifies the type of document you are writing to. Default value is "text/html" |
replace | Optional. When set, it causes the history entry for the new document to inherit the history entry from the parent document |
We have done a lot for this part. In the next part of the series, we shall look at the roots that give rise to my approach. I'll see you in the next part.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |