Document Object Properties




What is Console in JavaScript ??
In JavaScript, the console is an object which provides access to the browser debugging console. We can open a console in web browser

Document/ Window / Screen  objects

Here you can find document/ window objects, after assigning these values in console browser has to responsive. use this document and window objects, to get browser response.

                window
        document
        clear();
        alert();
        window.alert();
        window.console();

        screen();



Document Object Properties, 
Here you can find the document object, which we can find document properties using javascript, even you can modify every document using document object properties


        
        console.dir(document);
        console.log(document.title);
        document.title = "This is updated title";

        console.log(document.head);
        console.log(document.body);

        console.log(document.title);
        console.log(document.URL);
        console.log(document.scripts);

        console.log(charset);
        console.log(doctype);

        console.log(document.domain);
        console.log(document.activeElement);


EX

      
    <body>
        <script>
            document.write(document.title);
        </script>
    </body>

Document Object Properties and Methods

The following properties and methods can be used on HTML documents:

Property / MethodDescription
activeElementReturns the currently focused element in the document
addEventListener()Attaches an event handler to the document
adoptNode()Adopts a node from another document
anchorsDeprecated
appletsDeprecated
baseURIReturns the absolute base URI of a document
body

Sets or returns the document's body (the <body> element) :document.body.innerHTML;

charsetDeprecated
characterSetReturns the character encoding for the document
close()Closes the output stream previously opened with document.open()
cookieReturns all name/value pairs of cookies in the document
createAttribute()Creates an attribute node
createComment()Creates a Comment node with the specified text
createDocumentFragment()Creates an empty DocumentFragment node
createElement()Creates an Element node
createEvent()Creates a new event
createTextNode()Creates a Text node
defaultViewReturns the window object associated with a document, or null if none is available.
designModeControls whether the entire document should be editable or not.
doctypeReturns the Document Type Declaration associated with the document
documentElementReturns the Document Element of the document (the <html> element)
documentModeDeprecated
documentURISets or returns the location of the document
domainReturns the domain name of the server that loaded the document
domConfigDeprecated
embedsReturns a collection of all <embed> elements the document
execCommand()Deprecated
formsReturns a collection of all <form> elements in the document
getElementById()Returns the element that has the ID attribute with the specified value
getElementsByClassName()Returns a HTMLCollection containing all elements with the specified class name
getElementsByName()Deprecated
getElementsByTagName()Returns a HTMLCollection containing all elements with the specified tag name
hasFocus()Returns a Boolean value indicating whether the document has focus
headReturns the <head> element of the document
document.head.tagName;
imagesReturns a collection of all <img> elements in the document 
document.images.length;
implementationReturns the DOMImplementation object that handles this document
importNode()Imports a node from another document
inputEncodingDeprecated
lastModifiedReturns the date and time the document was last modified
linksReturns a collection of all <a> and <area> elements in the document that have a href attribute
normalize()Removes empty Text nodes, and joins adjacent nodes
normalizeDocument()Deprecated
open()Opens an HTML output stream to collect output from document.write()
querySelector()Returns the first element that matches a specified CSS selector(s) in the document
querySelectorAll()Returns a static NodeList containing all elements that matches a specified CSS selector(s) in the document
readyStateReturns the (loading) status of the document
referrerReturns the URL of the document that loaded the current document
removeEventListener()Removes an event handler from the document (that has been attached with the addEventListener() method)
renameNode()Deprecated
scriptsReturns a collection of <script> elements in the document
strictErrorCheckingDeprecated
titleSets or returns the title of the document
URLReturns the full URL of the HTML document
write()Writes HTML expressions or JavaScript code to a document
writeln()Same as write(), but adds a newline character after each statement