Document Object Model (DOM) Manipulating HTML Could actually alter - - PowerPoint PPT Presentation

document object model dom
SMART_READER_LITE
LIVE PREVIEW

Document Object Model (DOM) Manipulating HTML Could actually alter - - PowerPoint PPT Presentation

Document Object Model (DOM) Manipulating HTML Could actually alter the HTML text and re-render Much better: programmatic model of the page Document Object Model The document object model is a now-standard way to model the HTML


slide-1
SLIDE 1

Document Object Model (DOM)

  • Manipulating HTML

– Could actually alter the HTML text and re-render – Much better: programmatic model of the page

  • Document Object Model

– The document object model is a now-standard way to model the HTML elements on the page – Works the same for XML and (X)HTML

slide-2
SLIDE 2

Document Object Model (DOM)

<form action=“self.php” method=“POST”> <input type=“text” name=“product”> <input type=“text” name=“cost”> </form> Form

action: “self.php” method: “POST”

Input

type: “text” name: “product”

Input

type: “text” name: “cost”

(children)

  • The DOM is a hierarchical model of nodes

– Each node can have attributes – Each node can contain other nodes

slide-3
SLIDE 3

Document Object Model (DOM)

  • Access from scripts

– Modern web browser rendering engines reflect the DOM as scriptable objects – Any script running on the page has access to global variables

  • document – root of the html
  • window – handle to the browser window, with attributes such as

size, position and the location bar