SlideShare a Scribd company logo
Dom structures
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Dom structures
JOBS APPLIED = 0
RESPONSES = 0
Nithil.pp
nithilp@gmail.com
facebook.com/ nithil
padinare peediyekal
twitter.com/nithilpp
in.linkedin.com/in/nithil.pp
9995223505
DOM STRUCTURE
Document Object Model (DOM)
• The Document Object Model (DOM) is a programming API for
HTML and XML documents.
• Defines the logical structure of documents and the way a
document is accessed and manipulated.
• An interface to allow programs and scripts to update content,
structure, and style of documents dynamically.
• The DOM is not HTML nor is it JavaScript.
• It is something like the glue that binds them together.
DOM Objects
• DOM components are accessible as objects or
collections of objects.
• In HTML DOM
o The entire document is a document node.
o Every HTML element is an element node.
o The Every HTML attribute is an attribute node
o text inside HTML elements are text nodes.
o Comments are comment nodes.
• DOM components form a tree of nodes called Node
Tree
• nodes in the node tree have a hierarchical relationship to
each other.
i.e, Parent node, child node and siblings
Fig : HTML DOM tree
example.
Fig : image illustrates a part of the node tree and the relationship between the nodes.
Programming Interface
• All HTML elements are defined as objects.
• the programming interface is the object methods and object
properties.
• A method is an action you can do.
• A property is a value that you can get or set.
getElementById(id) get the node (element) with a
specified id
appendChild(node) insert a new child node (element)
removeChild(node) remove a child node (element)
•HTML DOM methods:
•HTML DOM properties:
innerHTML the text value of a node (element)
parentNode the parent node of a node
(element)
childNodes the child nodes of a node (element)
attributes the attributes nodes of a node
(element)
Accessing Nodes by id
• Access to elements by their id
– document.getElementById(<id>)
• returns the element with id <id>
– id attribute can be defined in each start tag.
Other Access Methods
• Access by elements' tag
– there are typically several elements with the same tag
– document.getElementsByTagName(<tag>)
– e.g.
• var li = document.getElementsByTagName(“li")[0];
//to get first li of ul.
• Access by elements' name attribute
– several elements can have the same name
– document.getElementsByName(<name>)
• returns the collection of elements with name <name>
Traversing DOM tree
• Traversal through node properties
– childNodes property
• the value is a collection of nodes
– has a length attribute
– an item can be reached by its index
• e.g. var body = html.childNodes[1];
– firstChild, lastChild properties
– nextSibling, previousSibling properties
– parentNode property
Document Object Model
<TABLE>
<ROWS>
<TR>
<TD>hi</TD>
<TD>there</TD>
</TR>
<TR>
<TD>hello</TD>
<TD>world</TD>
</TR>
</ROWS>
</TABLE>
Eg :JavaScript program to add two numbers.( Numbers are input
using textbox )
<html>
<head>
<script language="javascript">
function calculateNumbers()
{
var FirstNumber = document.getElementById("txtFirst").value;
FirstNumber = Number(FirstNumber);
var SecondNumber = document.getElementById("txtSecond").value;
SecondNumber = Number(SecondNumber);
var Total = (FirstNumber+SecondNumber);
document.frmCalculate.txtTotal.value = Total;
}
</script>
</head>
<body>
<form name="frmCalculate">
<input type="text" size="2" id="txtFirst" maxlength="2">+</input>
<input type="text" size="2" id="txtSecond" maxlength="2">=</input>
<input type="text" size="2" name="txtTotal" ></input><br>
<input type="button" value="Add" name="buttonCalculate"
onClick="calculateNumbers()"></input>
<input type="reset" value="Reset" name="buttonReset"></input>
</form>
</body>
</html>
Thank you…
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

More Related Content

PPTX
Object oriented programming concepts
PPTX
Object Oriented Concept
PPT
DOM Quick Overview
PPT
Lecture 4
PDF
PDF
Pursuing practices of Domain-Driven Design in PHP
Object oriented programming concepts
Object Oriented Concept
DOM Quick Overview
Lecture 4
Pursuing practices of Domain-Driven Design in PHP

What's hot (20)

PPTX
Lecture 1 oop
PPTX
Oo ps concepts in c++
PPTX
Fundamentals of OOP (Object Oriented Programming)
PDF
Ah java-ppt2
PPTX
Object oriented programming concept- Saurabh Upadhyay
PPTX
Brownfield Domain Driven Design
PPTX
Characteristics of oop
PPTX
Oops concept in c++ unit 3 -topic 4
PDF
itft-Fundamentals of object–oriented programming in java
PPTX
Introduction to OOP concepts
PPT
Object oriented programming (oop) cs304 power point slides lecture 01
PDF
Object Oriented Programming Lecture Notes
PPT
Object-oriented concepts
PPT
Pursuing Domain-Driven Design practices in PHP
PPTX
Characteristics of OOPS
PPTX
PDF
Introduction to object oriented programming
PPTX
Lecture 1 oop
Oo ps concepts in c++
Fundamentals of OOP (Object Oriented Programming)
Ah java-ppt2
Object oriented programming concept- Saurabh Upadhyay
Brownfield Domain Driven Design
Characteristics of oop
Oops concept in c++ unit 3 -topic 4
itft-Fundamentals of object–oriented programming in java
Introduction to OOP concepts
Object oriented programming (oop) cs304 power point slides lecture 01
Object Oriented Programming Lecture Notes
Object-oriented concepts
Pursuing Domain-Driven Design practices in PHP
Characteristics of OOPS
Introduction to object oriented programming
Ad
Ad

Similar to Dom structures (20)

PPTX
DOM and Events
PDF
Practical JavaScript Programming - Session 4/8
PPTX
Dom date and objects and event handling
PDF
JavaScript and DOM
PPTX
Document object model
PPTX
Web technologies-course 09.pptx
PPTX
DOM (document Object Model) in java Script).pptx
PDF
JavaScript - Chapter 12 - Document Object Model
PPTX
Dom in javascript
PPTX
JavaScript DOM - Dynamic interactive Code
PDF
DOM Enlightenment Exploring JavaScript and the Modern DOM 1st Edition Lindley...
DOCX
DOM(Document Object Model) in javascript
PPTX
Understanding the dom by Benedict Ayiko
PPT
6867389.ppt
PPT
6867389 (1).ppt
DOM and Events
Practical JavaScript Programming - Session 4/8
Dom date and objects and event handling
JavaScript and DOM
Document object model
Web technologies-course 09.pptx
DOM (document Object Model) in java Script).pptx
JavaScript - Chapter 12 - Document Object Model
Dom in javascript
JavaScript DOM - Dynamic interactive Code
DOM Enlightenment Exploring JavaScript and the Modern DOM 1st Edition Lindley...
DOM(Document Object Model) in javascript
Understanding the dom by Benedict Ayiko
6867389.ppt
6867389 (1).ppt

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Getting Started with Data Integration: FME Form 101
PDF
Electronic commerce courselecture one. Pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
A Presentation on Artificial Intelligence
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
Getting Started with Data Integration: FME Form 101
Electronic commerce courselecture one. Pdf
MIND Revenue Release Quarter 2 2025 Press Release
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
A Presentation on Artificial Intelligence
Accuracy of neural networks in brain wave diagnosis of schizophrenia
NewMind AI Weekly Chronicles - August'25-Week II
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectral efficient network and resource selection model in 5G networks
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Assigned Numbers - 2025 - Bluetooth® Document
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Dom structures

  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. JOBS APPLIED = 0 RESPONSES = 0
  • 6. Document Object Model (DOM) • The Document Object Model (DOM) is a programming API for HTML and XML documents. • Defines the logical structure of documents and the way a document is accessed and manipulated. • An interface to allow programs and scripts to update content, structure, and style of documents dynamically. • The DOM is not HTML nor is it JavaScript. • It is something like the glue that binds them together.
  • 7. DOM Objects • DOM components are accessible as objects or collections of objects. • In HTML DOM o The entire document is a document node. o Every HTML element is an element node. o The Every HTML attribute is an attribute node o text inside HTML elements are text nodes. o Comments are comment nodes.
  • 8. • DOM components form a tree of nodes called Node Tree • nodes in the node tree have a hierarchical relationship to each other. i.e, Parent node, child node and siblings Fig : HTML DOM tree example.
  • 9. Fig : image illustrates a part of the node tree and the relationship between the nodes.
  • 10. Programming Interface • All HTML elements are defined as objects. • the programming interface is the object methods and object properties. • A method is an action you can do. • A property is a value that you can get or set.
  • 11. getElementById(id) get the node (element) with a specified id appendChild(node) insert a new child node (element) removeChild(node) remove a child node (element) •HTML DOM methods: •HTML DOM properties: innerHTML the text value of a node (element) parentNode the parent node of a node (element) childNodes the child nodes of a node (element) attributes the attributes nodes of a node (element)
  • 12. Accessing Nodes by id • Access to elements by their id – document.getElementById(<id>) • returns the element with id <id> – id attribute can be defined in each start tag.
  • 13. Other Access Methods • Access by elements' tag – there are typically several elements with the same tag – document.getElementsByTagName(<tag>) – e.g. • var li = document.getElementsByTagName(“li")[0]; //to get first li of ul. • Access by elements' name attribute – several elements can have the same name – document.getElementsByName(<name>) • returns the collection of elements with name <name>
  • 14. Traversing DOM tree • Traversal through node properties – childNodes property • the value is a collection of nodes – has a length attribute – an item can be reached by its index • e.g. var body = html.childNodes[1]; – firstChild, lastChild properties – nextSibling, previousSibling properties – parentNode property
  • 16. Eg :JavaScript program to add two numbers.( Numbers are input using textbox ) <html> <head> <script language="javascript"> function calculateNumbers() { var FirstNumber = document.getElementById("txtFirst").value; FirstNumber = Number(FirstNumber); var SecondNumber = document.getElementById("txtSecond").value; SecondNumber = Number(SecondNumber); var Total = (FirstNumber+SecondNumber); document.frmCalculate.txtTotal.value = Total; } </script> </head> <body> <form name="frmCalculate"> <input type="text" size="2" id="txtFirst" maxlength="2">+</input> <input type="text" size="2" id="txtSecond" maxlength="2">=</input> <input type="text" size="2" name="txtTotal" ></input><br> <input type="button" value="Add" name="buttonCalculate" onClick="calculateNumbers()"></input> <input type="reset" value="Reset" name="buttonReset"></input> </form> </body> </html>
  • 18. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 19. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com