JS Document Object


Javascript Document object is a part of Window object, and provides various methods to modify the web page dynamically, such as through the API known as Document Object Model (DOM). All web pages openned by a browser are Document objects.


document.write() method write a line to the document.

document.write("test content line 1");
document.write("test content line 2");



document.open() opens an output stream. document.close() closes an output stream.

var win = window.open();
win.document.open();
win.document.write("test content");
win.document.close();



document.getElementById() get an element by the specified ID value. document.getElementsByName() get an element by the specified name. document.getElementsByTagName() get all elements by the specified tag name.

document.cookie sets and gets cookies related with current document.
document.domain gets the domain name of current document.
document.lastModified gets the last modification date and time of current document.
document.referrer gets all referal URLs.
document.title gets the title of current document.
document.URL gets the URL of current document.
document.all[] gets all HTML elements.
document.anchors[] gets all anchor references of current document.
document.forms[] gets all form references of current document.
document.images[] gets all image references of current document.
document.links[] gets all link references of current document.

endmemo.com © 2024  | Terms of Use | Privacy | Home