Home > Articles > Open Source > Ajax & JavaScript

JavaScript and the Document Object Model (DOM)

  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Close Window

Harvey M. DeitelPaul J. Deitel

Learn more…

Sorry, this author hasn't written any articles.

Sorry, this author doesn't have anything for sale.

Sorry, this author hasn't posted any blogs.

JavaScript for Programmers

This chapter is from the book
JavaScript for Programmers

The objects and collections in the W3C DOM give you flexibility in manipulating the elements of a web page. Paul J. Deitel and Harvey M. Deitel show you how to access the objects in a page, how to access the objects in a collection, and how to change element styles dynamically.
  • Our children may learn about heroes of the past. Our task is to make ourselves architects of the future.
  • Jomo Mzee Kenyatta
  • Though leaves are many, the root is one.
  • William Butler Yeats
  • The thing that impresses me most about America is the way parents obey their children.
  • Duke of Windsor
  • Most of us become parents long before we have stopped being children.
  • Mignon McLaughlin
  • To write it, it took three months; to conceive it three minutes; to collect the data in it—all my life.
  • F. Scott Fitzgerald
  • Sibling rivalry is inevitable. The only sure way to avoid it is to have one child.
  • Nancy Samalin

10.1 Introduction

In this chapter we introduce the Document Object Model (DOM). The DOM gives you access to all the elements on a web page. Inside the browser, the whole web page—paragraphs, forms, tables, etc.—is represented in an object hierarchy. Using JavaScript, you can create, modify and remove elements in the page dynamically.

Previously, both Internet Explorer and Netscape had different versions of Dynamic HTML, which provided similar functionality to the DOM. However, while they provided many of the same capabilities, these two models were incompatible with each other. In an effort to encourage cross-browser websites, the W3C created the standardized Document Object Model. Firefox, Internet Explorer 7, and many other major browsers implement most of the features of the W3C DOM.

This chapter begins by formally introducing the concept of DOM nodes and DOM trees. We then discuss properties and methods of DOM nodes and cover additional methods of the document object. We also discuss how to dynamically change style properties, which enables you to create many types of effects, such as user-defined background colors and animations. Then, we present a diagram of the extensive object hierarchy, with explanations of the various objects and properties, and we provide links to websites with further information on the topic.

  • Share ThisShare This
  • Your Account

Discussions

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jennifer  BortelWin FREE iPhone Developer Books and Videos- Introducing @InformIT Giveaways
By Jennifer Bortel on February 5, 2010 No Comments

Apples’s recent iPad announcement made our hearts flutter so we couldn’t resist making an announcement of our own!

Today marks the first ever @InformIT Giveaway!

We’ll regularly post a video like this one profiling spectacular prizes we’re giving away—from books and videos to T-shirts and other exciting stuff. Check out the video below to see the giveaways for today, and then scroll down for more prize details and instructions on how to win them!

Dustin Sullivan"Every OSX developer should have this book on their desk."
By Dustin Sullivan on February 1, 2010 No Comments

That was the sentence Mike Riley ended his recent Dr Dobb's CodeTalk review of Cocoa Programming Developer's Handbook with.

David ChisnallCocoa Tip of the Day, 1/29/10
By David Chisnall on January 29, 2010 No Comments

Don't ignore old versions of OS X.

See All Related Blogs

Informit Network