Javascript Dom
Javascript Dom
Javascript Dom
WHAT IS DOM
• Documet -> Just like a file
• Object-> is anything you put inside html document
• Model-> layout of its structure
<html>
<head></head>
<body></body>
</html>
For head and body html is direct parent
<html>
<head>
<title></title>
</head>
<body>
<h1></h1>
<p></p>
</body>
</html>
• <title> parent is <head>
• <h1><p> parent is <body>
SO DOM IS USED TO SHOW HIERARCHICAL RELATIONSHIP AMONG
ELEMENTS
Properties
• It is an application programming interface for HTML & XML
documents
• Used to Navigate through structure of document, add , modify and
delete elements dynamically
• It is object oriented representation of web pages
• Used to represent document with a logical tree
• Treat every HTML tag as object
• Access properties of these objects using built in methods of objects
• Functionality of objects can be controlled dynamically
Navigator
Window
Document
Head Body
Title H1 P
Window.document.head.title.text=HTML
Structure of DOM
JSS DOM
JSSS DOM
Exercise : Change the checked value of checkbox and radio button
Window Object window.open()
window.close()
window.innerHeight
window.moveTo()
WINDOW
window.resizeTo() window.innerWidth
DOCUMENT LOCATION
HISTORY