DOM – DOCUMENT OBJECT MODE
HTML DOC –Browser – Browser Engine(html parser) – DOM
Tree structure takes less time for searching that’s why we prefer tree structure in DOM.
Why we prefer object model? Object model means OOPS concept based it have features like data abstraction, encapsulation….
Window -- Window is the default thing available in the Browser’s JavaScript Engine.
Document -- Document is property of Window
Screen – Physical dimension of the browser
Draw some sampl tree
We can create html with the help of tag and make it dynamic(to do some action) by adding javascript using script tag then why specifically we need this dom àWill understand in future classes that we can’t do something directly with the tag.
DOM MANIPULATION
var element =document.createElement(‘tag’)
Element.setAttribute(“attribute”,”name”)
If we have morethan one same attribute for the element we can’t use setAttributes because it gets Override
Element.setClassName (“name1 name2”)
Element.innerHTML = “<p><b><PERFECT</b></p>”
Element.innerText = “PERFECT”
How to set Style Attribute
divdom1.setAttribute("style","font-size:40px;border-radius:5px")
EASY POPUP FUNCTIONS
ALERT
Alert Pop-Up
PROMPT
Ask us to enter Some Value
CONFIRM
Ok or Cancel Pop Up
Comments
Post a Comment