HTML DOM Document Object Collections, Properties, and Methods
HTML DOM Document Object Examples
Purpose: – Illustrates the JavaScript syntax for working with the HTML DOM Document Object.
HTML DOM Document Object Examples
| Document Object Collections | |
| anchors[] | Allows you to access all of the Anchor objects in a document |
| forms[] | Allows you to access all of the Form objects in a document |
| images[] | Allows you to access all of the Image objects in a document |
| links[] | Allows you to access all of the Area and Link objects in a document |
| Document Object Properties | |
| body | Allows you to access the body element |
| cookie | Allows you to set or return all cookies associated with the current document |
| domain | Allows you to access the domain name for the current document |
| lastModified | Date and time the document was last modified |
| referrer | Allows you to access the URL of the document that loaded the current one |
| title | Allows you to access the title of the document |
| URL | Allows you to access the URL of the document |
| Document Object Methods | |
| close() | Closes the output stream and displays the collected data |
| getElementById() | Allows you to access the first object with the specified id |
| GetElementsByName() | Provides access to a collection of objects with the specified name |
| getElementsByTagName() | Provides access to a collection of objects with the specified tagname |
| open() | Opens a stream to collect the output from document.write or document.writeln methods |
| write() | Writes JavaScript code or HTML expressions to a document |
| writeln() | Same as write method and it adds a new line character after each argument |
