JavaScript Document Object

The document object provides methods, properties, and events that allow you to access, modify, and manipulate the content and structure of the web page dynamically.

Document Object Model (DOM). It represents the web page itself and provides methods and properties that allow you to interact with and manipulate the content and structure of the page dynamically.

Method Description
createElement()Create and display elements dynamically
referrerPrevious page or the referred page address
page titleTitle of the page and how to change it
URLURL in full along with domain name of the page
lastModifiedLast Modified or change date of the page
domainName of the domain of the current page
writeSending output to screen or printing the string
CookiesCooking adding , reading and removing
getElementsByTagNameNumber of tags and managing property
getElementsByIdManaging by ID of the element
getElementsByNameManaging by Name of the element
hasFocus()Checking window is active or not
Linksgetting Links of the document
anchorsArray of anchors using name attribute

What we can do using document object?

  1. Access and interact with elements in the web page by their IDs, classes, tags, etc.
  2. Modify the content and attributes of HTML elements.
  3. Create new HTML elements and add them to the page.
  4. Apply CSS styles to elements.
  5. Add event listeners to elements and respond to user actions, like clicks and keypresses.
  6. Manipulate the browser's history and location for navigation purposes (e.g., using methods like history.pushState and history.replaceState).
  7. Access information about the browser and the current page, such as the URL or title (e.g., document.URL or document.title).
  8. Perform various other operations related to the web page and its contents, like handling forms, managing cookies, or interacting with browser plugins/extensions.

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer