274
Chapter 4.5
a brief review
60 Second Review
ü The browser represents the HTML, CSS,
and JavaScript that makes up a web page
as a tree full of objects, using the Document
Object Model, or DOM.
ü You can view and change the DOM using
JavaScript code. Changes you make to the
DOM are automatically reflected in the web
page that the browser is displaying.
ü You can use the JavaScript document object
to access the browser’s DOM tree for the
current web page.
ü You can use the DOM from any web
application, not just asynchronous ones.
ü A DOM tree is made up of different types of
nodes: elements nodes, attribute notes, and
text nodes.
ü Element nodes can have only a single
parent. If you change an element’s parent, or
add the element as the child of another node,
you are moving the element in the DOM tree.
ü You can add CSS styles and JavaScript
event handlers to DOM nodes using
JavaScript code.
Check it out for yourself!
The Great Chapter 4 Coding Challenge
Write a killer web application that uses the
Document Object Model to create a dynamic
user interface, without writing any Ajax code.
Remember this? You just built a
slick web app, without a single line of
asynchronous JavaScript. Nice job!
Don’t think we’ve left asynchronous
programming altogether... we’re getting
ready to dive back in as soon as you turn
over to Chapter 5.