SlideShare a Scribd company logo
ME PRESENTATION
ON
DOCUMENT OBJECT MODEL
PREPARED BY :
UPADHYAY RAKSHITA R.
Er No : 140370707018
Roll No : 24
Contents….
2
 Introduction
 How DOM works?
 Document tree
 HTML DOM access nodes
 DOM Properties
 DOM Methods
 References
8/5/2015
Introduction
 The HTML DOM defines a standard way for accessing
and manipulating HTML documents.
 It presents an HTML document as a tree-structure with
elements, attributes, and text.
 With JavaScript you can restructure an entire HTML
document. You can add, remove, change, or reorder items
on a page.
8/5/2015
3
 This access, along with methods and properties to add,
move, change, or remove HTML elements, is given
through DOM.
 The DOM can be used by JavaScript to read and change
HTML, XHTML, and XML documents.
8/5/2015
4
5
How the DOM works?
<head><script>
function toggle()
{ document.img.button1.src=“button_on.gif”; }
</script></head>
<body>
<a href=“test.html” onmouseover=“toggle()”> <img name=“button1” src=“button_off.gif”></a>
</body>
action
reaction
Action Event JavaScript DOM Reactio
nsrc=“button_off.gif” onmouseov
er
toggle() document.img.butto
n1
Src=“button_on.gi
f”
1) User moves mouse over object
2) Event senses that something happened to the object
3) JavaScript tells the object what to do (Even handler)
4) Locates object on the web page
5) Object’s image source is changed
8/5/2015
Document Tree (Node Tree)
<html>
<head>
<title> My title </title>
</head>
<body>
<h1> My header </h1>
<a href=“http://.... > My link </a>
</body>
</html>
8/5/2015
6
Document Tree (Node Tree)
8/5/2015
7
HTML DOM Example
<html>
<head>
<script type="text/javascript">
function ChangeColor() {
document.body.bgColor="yellow" }
</script>
</head>
<body onclick="ChangeColor()">
Click on this document!
</body>
</html>
8/5/2015
8
HTML DOM Access Nodes
 The getElementById() method returns the element with
the specified ID:
document.getElementById("someID");
 The getElementsByTagName() method returns all
elements (as a nodeList) with the specified tag name.
document.getElementsByTagName("p");
8/5/2015
9
DOM Objects
 DOM Anchor DOM Area
DOM Base DOM Body
DOM Button DOM Event
DOM Form DOM Frame
DOM Frameset DOM IFrame
DOM Image DOM Input Button
DOM Input Checkbox DOM Input File
DOM Input Hidden DOM Input Password
DOM Input Radio DOM Input Reset
DOM Input Submit DOM Input Text
DOM Link DOM Meta
DOM Object DOM Option
DOM Select DOM Style
DOM Table DOM TableCell
DOM TableRow DOM Textarea
8/5/2015
10
DOM Properties
11
8/5/2015
DOM Methods
12
8/5/2015
References
13
 www.w3school.com
 www.tutorialspoint.com/javascript
8/5/2015
8/5/2015

More Related Content

What's hot

JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
Mohammed Arif
 
javascript objects
javascript objectsjavascript objects
javascript objects
Vijay Kalyan
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
Priya Goyal
 
Ajax ppt
Ajax pptAjax ppt
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
WebStackAcademy
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
Taha Malampatti
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 
Functions in javascript
Functions in javascriptFunctions in javascript
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
Mindy McAdams
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
NexThoughts Technologies
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
Bui Kiet
 
Java script ppt
Java script pptJava script ppt
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
Bala Narayanan
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Php string function
Php string function Php string function
Php string function
Ravi Bhadauria
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
Alaref Abushaala
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
Ravinder Kamboj
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap
1amitgupta
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 

What's hot (20)

JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Html presentation
Html presentationHtml presentation
Html presentation
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
JavaScript Tutorial
JavaScript  TutorialJavaScript  Tutorial
JavaScript Tutorial
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Php string function
Php string function Php string function
Php string function
 
Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 

Similar to Dom

FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document Object
Arti Parab Academics
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
Lilia Sfaxi
 
2.java script dom
2.java script  dom2.java script  dom
2.java script dom
PhD Research Scholar
 
Html css java script basics All about you need
Html css java script basics All about you needHtml css java script basics All about you need
Html css java script basics All about you need
Dipen Parmar
 
DOM(Document Object Model) in javascript
DOM(Document Object Model) in javascriptDOM(Document Object Model) in javascript
DOM(Document Object Model) in javascript
Rashmi Mishra
 
Html
HtmlHtml
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basics
xu fag
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basics
Nikita Garg
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basics
Minea Chem
 
Additional HTML
Additional HTML Additional HTML
Additional HTML
Doeun KOCH
 
HTML web design_ an introduction to design
HTML web design_ an introduction to designHTML web design_ an introduction to design
HTML web design_ an introduction to design
SureshSingh142
 
HTML CSS by Anubhav Singh
HTML CSS by Anubhav SinghHTML CSS by Anubhav Singh
HTML CSS by Anubhav Singh
Anubhav659
 
HTML Basic, CSS Basic, JavaScript basic.
HTML Basic, CSS Basic, JavaScript basic.HTML Basic, CSS Basic, JavaScript basic.
HTML Basic, CSS Basic, JavaScript basic.
Beqa Chacha
 
HTML guide for beginners
HTML guide for beginnersHTML guide for beginners
HTML guide for beginners
Thesis Scientist Private Limited
 
3 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp023 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp02
Aditya Varma
 
Document object model
Document object modelDocument object model
Document object model
Amit kumar
 
Dom date and objects and event handling
Dom date and objects and event handlingDom date and objects and event handling
Dom date and objects and event handling
smitha273566
 

Similar to Dom (20)

FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document Object
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
2.java script dom
2.java script  dom2.java script  dom
2.java script dom
 
Html css java script basics All about you need
Html css java script basics All about you needHtml css java script basics All about you need
Html css java script basics All about you need
 
DOM(Document Object Model) in javascript
DOM(Document Object Model) in javascriptDOM(Document Object Model) in javascript
DOM(Document Object Model) in javascript
 
Html
HtmlHtml
Html
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basics
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basics
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basics
 
Dom
DomDom
Dom
 
Additional HTML
Additional HTML Additional HTML
Additional HTML
 
HTML web design_ an introduction to design
HTML web design_ an introduction to designHTML web design_ an introduction to design
HTML web design_ an introduction to design
 
HTML CSS by Anubhav Singh
HTML CSS by Anubhav SinghHTML CSS by Anubhav Singh
HTML CSS by Anubhav Singh
 
HTML Basic, CSS Basic, JavaScript basic.
HTML Basic, CSS Basic, JavaScript basic.HTML Basic, CSS Basic, JavaScript basic.
HTML Basic, CSS Basic, JavaScript basic.
 
HTML guide for beginners
HTML guide for beginnersHTML guide for beginners
HTML guide for beginners
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
3 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp023 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp02
 
Document object model
Document object modelDocument object model
Document object model
 
Dom date and objects and event handling
Dom date and objects and event handlingDom date and objects and event handling
Dom date and objects and event handling
 

More from Rakshita Upadhyay

Rs methodologyandreliability
Rs methodologyandreliabilityRs methodologyandreliability
Rs methodologyandreliabilityRakshita Upadhyay
 
Plc and hmi based stenter machine poster
Plc and hmi based stenter machine posterPlc and hmi based stenter machine poster
Plc and hmi based stenter machine posterRakshita Upadhyay
 
Plc and hmi baed stenter machine01
Plc and hmi baed stenter machine01Plc and hmi baed stenter machine01
Plc and hmi baed stenter machine01Rakshita Upadhyay
 
Induction machine modelling
Induction machine modelling Induction machine modelling
Induction machine modelling
Rakshita Upadhyay
 
Reneable energy
Reneable energyReneable energy
Reneable energy
Rakshita Upadhyay
 

More from Rakshita Upadhyay (9)

Rs methodologyandreliability
Rs methodologyandreliabilityRs methodologyandreliability
Rs methodologyandreliability
 
Optimal control system
Optimal control systemOptimal control system
Optimal control system
 
Insulation coordination
Insulation coordinationInsulation coordination
Insulation coordination
 
Fc tcr.newpptx
Fc tcr.newpptxFc tcr.newpptx
Fc tcr.newpptx
 
load shedding
load sheddingload shedding
load shedding
 
Plc and hmi based stenter machine poster
Plc and hmi based stenter machine posterPlc and hmi based stenter machine poster
Plc and hmi based stenter machine poster
 
Plc and hmi baed stenter machine01
Plc and hmi baed stenter machine01Plc and hmi baed stenter machine01
Plc and hmi baed stenter machine01
 
Induction machine modelling
Induction machine modelling Induction machine modelling
Induction machine modelling
 
Reneable energy
Reneable energyReneable energy
Reneable energy
 

Dom

  • 1. ME PRESENTATION ON DOCUMENT OBJECT MODEL PREPARED BY : UPADHYAY RAKSHITA R. Er No : 140370707018 Roll No : 24
  • 2. Contents…. 2  Introduction  How DOM works?  Document tree  HTML DOM access nodes  DOM Properties  DOM Methods  References 8/5/2015
  • 3. Introduction  The HTML DOM defines a standard way for accessing and manipulating HTML documents.  It presents an HTML document as a tree-structure with elements, attributes, and text.  With JavaScript you can restructure an entire HTML document. You can add, remove, change, or reorder items on a page. 8/5/2015 3
  • 4.  This access, along with methods and properties to add, move, change, or remove HTML elements, is given through DOM.  The DOM can be used by JavaScript to read and change HTML, XHTML, and XML documents. 8/5/2015 4
  • 5. 5 How the DOM works? <head><script> function toggle() { document.img.button1.src=“button_on.gif”; } </script></head> <body> <a href=“test.html” onmouseover=“toggle()”> <img name=“button1” src=“button_off.gif”></a> </body> action reaction Action Event JavaScript DOM Reactio nsrc=“button_off.gif” onmouseov er toggle() document.img.butto n1 Src=“button_on.gi f” 1) User moves mouse over object 2) Event senses that something happened to the object 3) JavaScript tells the object what to do (Even handler) 4) Locates object on the web page 5) Object’s image source is changed 8/5/2015
  • 6. Document Tree (Node Tree) <html> <head> <title> My title </title> </head> <body> <h1> My header </h1> <a href=“http://.... > My link </a> </body> </html> 8/5/2015 6
  • 7. Document Tree (Node Tree) 8/5/2015 7
  • 8. HTML DOM Example <html> <head> <script type="text/javascript"> function ChangeColor() { document.body.bgColor="yellow" } </script> </head> <body onclick="ChangeColor()"> Click on this document! </body> </html> 8/5/2015 8
  • 9. HTML DOM Access Nodes  The getElementById() method returns the element with the specified ID: document.getElementById("someID");  The getElementsByTagName() method returns all elements (as a nodeList) with the specified tag name. document.getElementsByTagName("p"); 8/5/2015 9
  • 10. DOM Objects  DOM Anchor DOM Area DOM Base DOM Body DOM Button DOM Event DOM Form DOM Frame DOM Frameset DOM IFrame DOM Image DOM Input Button DOM Input Checkbox DOM Input File DOM Input Hidden DOM Input Password DOM Input Radio DOM Input Reset DOM Input Submit DOM Input Text DOM Link DOM Meta DOM Object DOM Option DOM Select DOM Style DOM Table DOM TableCell DOM TableRow DOM Textarea 8/5/2015 10