Web Programming

Tufts University
Department of Computer Science
Fall 2009

JavaScript Objects and the Document Object Model (DOM)

JavaScript Objects

Document Object Model (DOM)

Consider the Example

Nodes

Global DOM Objects

Traversing the DOM Tree

Modifying a DOM Tree

Example of Modifying a DOM Tree

Group Exercises

  1. Make a copy of the home page of our course website. Implement a feature that highlights (in yellow) all the paragraphs in the document, and echo all the text inside of the paragraph tags to a console (e.g., in Firebug).
  2. Using Firebug (Firefox only), view all the images on the Microsoft home page via DOM tab. How many images are there? Finally, modify the Microsoft logo to something else...

mchow@cs.tufts.edu

Valid XHTML 1.0 Transitional