SlideShare a Scribd company logo
4
Most read
6
Most read
11
Most read
DOM
(DOCUMENT OBJECT MODEL)
Presented by---
•Agnish Majumder
•Anindya Sundar De
•Gopal Basak
•Rashbihari Halder
Contents
• Introduction
• Pre-knowledge
• Definition
• Types of DOM
• DOM hierarchy
• Tree structure
• Advantages and Disadvantages
• Conclusion
Introduction
• The Document Object Model (DOM) is a programming
API(Application Programming Interface) for HTML and
XML documents.
• DOM defines the logical structure of documents and the
way a document is accessed and manipulated.
Pre-knowledge
Before going to DOM we have to know about -
HTML (Hyper Text Markup Language): How to
Display the Data in the Webpage.
XML (Extensible Markup Language): How to
Describe the Data .
DHTML (Dynamic HTML): How to Add Movement or
Animation to an HTML Document.
JAVASCRIPT: How to make Web Content Dynamic.
Definition of DOM
• TheW3C Document Object Model (DOM) is a platform and
language-neutral interface that allows programs and
scripts to dynamically access and update the content,
structure, and style of a document.
• The DOM defines the objects and properties of all
document elements and the methods (interface) to access
them.
• The DOM is aW3C (World WideWeb Consortium) standard.
• The DOM defines the logical structure of objects and the
way an object is accessed and manipulated.
Types of DOM
There are mainly 3 parts or levels of DOM---
• Core DOM - standard model for any structured document
• XML DOM - standard model for XML documents
• HTML DOM - standard model for HTML documents
The DOM Programming Interface
• In the DOM, all HTML elements are defined as objects.
• The programming interface is the properties and methods
of each object.
• A property is a value that one can get or set (like changing
the content of an HTML element).
• A method is an action one can do (like adding or deleting an
HTML element).
DOM Document
Method Description
document.getElementById() Returns the element that has the ID
attribute with the specified value
document.getElementsByClassName() Returns a Node List containing all
elements with the specified class name
document.getElementsByTagName() Returns a Node List containing all
elements with the specified tag name
Event Description
onclick The event occurs when the user clicks on
an element
onmouseover The event occurs when the pointer is
moved onto an element, or onto one of
its children
DOM Events
DOM hierarchy
Tree Structure
• The tree structure of DOM is known as Node-tree
• All the nodes in this tree have relationship with each other.
Nodes in tree
• The DOM represents documents as a hierarchy of Node
objects.
• Element Node – contains an HTML tag
• Text Node – contains text
• Attribute node – Represents attribute of Element node
• Text Nodes are contained within Element Nodes
• Example : <body bgcolor=“blue”> JIS </body>
Here, <body> is element node, “bgcolor” is attribute
node and “JIS” is text node
Relationship among Nodes
• Every node has exactly one parent node (except root) and a
parent node can have one or more than one child nodes.
• Root node :-The topmost node of the tree is the root node.
As it is topmost, so there is no parent of this root node.
• Leaf :-The leaf nodes are the nodes which have no child
node.
• Siblings :-The nodes which have same parent are the
siblings of each other.
Example of parent-child relationship
Tree representation
• Here <html> node is the root
node as it has no parent.
• <head> and <body> are two
child nodes of <html>
• <h2> & <p> are siblings .
• JIS, JIS College of Engineering
etc are the leaf nodes.
<html>
<title> <h2>
<head> <body>
<p>
Information
Technology
JIS
JIS College
of
Engineering
HTML DOM-Access nodes
• We can access a node in three ways:
1. By using the getElementById() method
2. By using the getElementsByTagName() method
3. By navigating the node tree( using the node relationships )
The getElementById() Method
• This method returns the element with the specified ID
Syntax--
• document.getElementById("ID");
The getElementsByTagName() Method
• This method returns all elements with a specified tag name
Syntax--
• document.getElementsByTagName("tagname");
Example
Navigating node-tree
• The three properties parentNode, firstChild, and lastChild
follow the document structure and allow short distance
travel in the document.
DOM Advantages and disadvantages
Advantages
• Robust API for the DOM tree
• Relatively simple to modify the data structure and extract
data
Disadvantages
• Stores the entire document in memory
• As Dom was written for any language, method naming
conventions don’t follow standard java programming
conventions
Conclusion
• DOM is a tree representation of an XML document in memory.
• With the help of DOM the tree structure of any HTML or XML
code can be easily implemented.
• DOM helps to make a proper sense about the parent and child
nodes in a tree structure of a code.
• The document object model can be thought of as a hierarchy
moving from the most general object to the most specific.
For your patience

More Related Content

PPTX
An Introduction to the DOM
PPTX
Java script
PDF
javascript objects
PPTX
Java script
PPTX
Javascript functions
PPTX
Java script
An Introduction to the DOM
Java script
javascript objects
Java script
Javascript functions
Java script

What's hot (20)

PPT
XML Schema
PPT
Document Object Model
PPTX
Introduction to the DOM
PPTX
Cascading Style Sheet (CSS)
PDF
jQuery for beginners
PPTX
Dom(document object model)
PPTX
PDF
JavaScript - Chapter 12 - Document Object Model
PPTX
Css position
PPSX
Javascript variables and datatypes
PDF
Xml schema
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
PPTX
Complete Lecture on Css presentation
PPTX
An Overview of HTML, CSS & Java Script
PPTX
Document object model
PPTX
Ajax
PPTX
Asp.NET Validation controls
PPT
MYSQL - PHP Database Connectivity
PPTX
XML Schema
Document Object Model
Introduction to the DOM
Cascading Style Sheet (CSS)
jQuery for beginners
Dom(document object model)
JavaScript - Chapter 12 - Document Object Model
Css position
Javascript variables and datatypes
Xml schema
JavaScript - Chapter 13 - Browser Object Model(BOM)
Complete Lecture on Css presentation
An Overview of HTML, CSS & Java Script
Document object model
Ajax
Asp.NET Validation controls
MYSQL - PHP Database Connectivity
Ad

Similar to Document Object Model (DOM) (20)

PPTX
Web technologies-course 09.pptx
PPT
DOM Quick Overview
PPTX
Understanding the dom by Benedict Ayiko
PPTX
Electronics is a scientific and engineering discipline that studies and appli...
PDF
JavaScript and DOM
PPT
6867389.ppt
PPT
6867389 (1).ppt
PPT
6867389.ppt
PPT
Document Object Model
DOCX
DOM(Document Object Model) in javascript
PPTX
Dom date and objects and event handling
PPTX
Document Object Model
PDF
Introduction to Javascript
PPTX
Dom in javascript
PPTX
Digital Marketing Company
PPTX
WEB TECHNOLOGY Unit-4.pptx
PPTX
DOM and Events
Web technologies-course 09.pptx
DOM Quick Overview
Understanding the dom by Benedict Ayiko
Electronics is a scientific and engineering discipline that studies and appli...
JavaScript and DOM
6867389.ppt
6867389 (1).ppt
6867389.ppt
Document Object Model
DOM(Document Object Model) in javascript
Dom date and objects and event handling
Document Object Model
Introduction to Javascript
Dom in javascript
Digital Marketing Company
WEB TECHNOLOGY Unit-4.pptx
DOM and Events
Ad

Recently uploaded (20)

PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Construction Project Organization Group 2.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Digital Logic Computer Design lecture notes
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
bas. eng. economics group 4 presentation 1.pptx
CH1 Production IntroductoryConcepts.pptx
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Construction Project Organization Group 2.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Internet of Things (IOT) - A guide to understanding
Digital Logic Computer Design lecture notes
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Mechanical Engineering MATERIALS Selection
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CYBER-CRIMES AND SECURITY A guide to understanding
Model Code of Practice - Construction Work - 21102022 .pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Embodied AI: Ushering in the Next Era of Intelligent Systems
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf

Document Object Model (DOM)

  • 2. Presented by--- •Agnish Majumder •Anindya Sundar De •Gopal Basak •Rashbihari Halder
  • 3. Contents • Introduction • Pre-knowledge • Definition • Types of DOM • DOM hierarchy • Tree structure • Advantages and Disadvantages • Conclusion
  • 4. Introduction • The Document Object Model (DOM) is a programming API(Application Programming Interface) for HTML and XML documents. • DOM defines the logical structure of documents and the way a document is accessed and manipulated.
  • 5. Pre-knowledge Before going to DOM we have to know about - HTML (Hyper Text Markup Language): How to Display the Data in the Webpage. XML (Extensible Markup Language): How to Describe the Data . DHTML (Dynamic HTML): How to Add Movement or Animation to an HTML Document. JAVASCRIPT: How to make Web Content Dynamic.
  • 6. Definition of DOM • TheW3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document. • The DOM defines the objects and properties of all document elements and the methods (interface) to access them. • The DOM is aW3C (World WideWeb Consortium) standard. • The DOM defines the logical structure of objects and the way an object is accessed and manipulated.
  • 7. Types of DOM There are mainly 3 parts or levels of DOM--- • Core DOM - standard model for any structured document • XML DOM - standard model for XML documents • HTML DOM - standard model for HTML documents
  • 8. The DOM Programming Interface • In the DOM, all HTML elements are defined as objects. • The programming interface is the properties and methods of each object. • A property is a value that one can get or set (like changing the content of an HTML element). • A method is an action one can do (like adding or deleting an HTML element).
  • 9. DOM Document Method Description document.getElementById() Returns the element that has the ID attribute with the specified value document.getElementsByClassName() Returns a Node List containing all elements with the specified class name document.getElementsByTagName() Returns a Node List containing all elements with the specified tag name Event Description onclick The event occurs when the user clicks on an element onmouseover The event occurs when the pointer is moved onto an element, or onto one of its children DOM Events
  • 11. Tree Structure • The tree structure of DOM is known as Node-tree • All the nodes in this tree have relationship with each other.
  • 12. Nodes in tree • The DOM represents documents as a hierarchy of Node objects. • Element Node – contains an HTML tag • Text Node – contains text • Attribute node – Represents attribute of Element node • Text Nodes are contained within Element Nodes • Example : <body bgcolor=“blue”> JIS </body> Here, <body> is element node, “bgcolor” is attribute node and “JIS” is text node
  • 13. Relationship among Nodes • Every node has exactly one parent node (except root) and a parent node can have one or more than one child nodes. • Root node :-The topmost node of the tree is the root node. As it is topmost, so there is no parent of this root node. • Leaf :-The leaf nodes are the nodes which have no child node. • Siblings :-The nodes which have same parent are the siblings of each other.
  • 14. Example of parent-child relationship
  • 15. Tree representation • Here <html> node is the root node as it has no parent. • <head> and <body> are two child nodes of <html> • <h2> & <p> are siblings . • JIS, JIS College of Engineering etc are the leaf nodes. <html> <title> <h2> <head> <body> <p> Information Technology JIS JIS College of Engineering
  • 16. HTML DOM-Access nodes • We can access a node in three ways: 1. By using the getElementById() method 2. By using the getElementsByTagName() method 3. By navigating the node tree( using the node relationships )
  • 17. The getElementById() Method • This method returns the element with the specified ID Syntax-- • document.getElementById("ID"); The getElementsByTagName() Method • This method returns all elements with a specified tag name Syntax-- • document.getElementsByTagName("tagname");
  • 19. Navigating node-tree • The three properties parentNode, firstChild, and lastChild follow the document structure and allow short distance travel in the document.
  • 20. DOM Advantages and disadvantages Advantages • Robust API for the DOM tree • Relatively simple to modify the data structure and extract data Disadvantages • Stores the entire document in memory • As Dom was written for any language, method naming conventions don’t follow standard java programming conventions
  • 21. Conclusion • DOM is a tree representation of an XML document in memory. • With the help of DOM the tree structure of any HTML or XML code can be easily implemented. • DOM helps to make a proper sense about the parent and child nodes in a tree structure of a code. • The document object model can be thought of as a hierarchy moving from the most general object to the most specific.