SlideShare ist ein Scribd-Unternehmen logo
1 von 14
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

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
JavaScript & Dom Manipulation
JavaScript & Dom ManipulationJavaScript & Dom Manipulation
JavaScript & Dom Manipulation
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Css selectors
Css selectorsCss selectors
Css selectors
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Javascript
JavascriptJavascript
Javascript
 
css.ppt
css.pptcss.ppt
css.ppt
 
An Introduction to the DOM
An Introduction to the DOMAn Introduction to the DOM
An Introduction to the DOM
 
Js ppt
Js pptJs ppt
Js ppt
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
jQuery
jQueryjQuery
jQuery
 

Ähnlich wie 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 ObjectArti Parab Academics
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
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 needDipen Parmar
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basicsMinea Chem
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basicsNikita Garg
 
4. html css-java script-basics
4. html css-java script-basics4. html css-java script-basics
4. html css-java script-basicsxu fag
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
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 designSureshSingh142
 
HTML CSS by Anubhav Singh
HTML CSS by Anubhav SinghHTML CSS by Anubhav Singh
HTML CSS by Anubhav SinghAnubhav659
 
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
 
3 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp023 1-html-fundamentals-110302100520-phpapp02
3 1-html-fundamentals-110302100520-phpapp02Aditya Varma
 
Document object model
Document object modelDocument object model
Document object modelAmit 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 handlingsmitha273566
 
HTML5 Essential Training
HTML5 Essential TrainingHTML5 Essential Training
HTML5 Essential TrainingKaloyan Kosev
 

Ähnlich wie 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
 
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
 
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
 
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
 
HTML5 Essential Training
HTML5 Essential TrainingHTML5 Essential Training
HTML5 Essential Training
 

Mehr von Rakshita Upadhyay

Mehr von 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