Chapter 12

12.1

State whether each of the following is true or false. If false, explain why.

a) Every XHTML element in a page is represented by a DOM tree. False. Every element is represented by a DOM node. Each node is a memeber of the document's DOM tree.

b) A text node cannot have child nodes. True.

c) The document node in a DOM tree cannot have child nodes. False. The document is the root node, therefore has no parent node.

d) You can change an element's style class dynamically with the style property. False. The style class is changed with the className property.

e) The createElement method creates a new nod and inserts it into the document. False. The createElement method creates a node, but does not insert it into the DOM tree.

f) The setInterval method calls a function repeatedly at a set time interval. True.

g) The insertBefore method is called on the document object, taking a new node and an existing one to insert the new one before. False. insertBefore is called on the parent.

h) The most recently started interval is stopped when the clearInterval method is called. False. clearInterval takes an interval identifier as an argument to determine which interval to end.

i) The collection links contains all the links in a document with specified name or id attributes. False. The links collection contains all links in a document.

12.2

Fill in the blanks for each of the following statements.

a) The innerHTML property refers to the text inside an element, including XHTML tags.

b) A document's DOM tree represents all of the nodes in a document, as well as their relationships to each other.

c) The length property contains the number of elements in a collection.

d) The item method allows access to an individual element in a collection.

e) The images collection contains all the img elements on a page.

f) The history object contains information about the sties that a user previously visited.

g) CSS properties may be accessed using the style object.

12.8

News:

Working on Chapter 15