Document Object
Advertisements
Document Object
The document object represents the whole html document. When html document is loaded in the browser, it becomes a document object. It is the root element that represents the html document.
Methods of document object
| Method | Description |
|---|---|
| write("string") | writes the given string on the document. |
| writeln("string") | Same as write(), but adds a newline character after each statement. |
| getElementById() | returns the element having the given id value. |
| getElementsByName() | returns all the elements having the given name value. |
| getElementsByTagName() | returns all the elements having the given tag name. |
| getElementsByClassName() | returns all the elements having the given class name. |
Google Advertisment
