Chapter 12
12.1 State whether each of the following is true or false. If false, explain why.
- 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 member of the document's DOM tree.
- A text node cannot have child nodes. True.
- The document node in a DOM tree cannot have child nodes. False. The document is the root node.
- You can change an element's style class dynamically with the style property. False. The style class is changed with the className property.
- The createElement method creates a new node and inserts it into the document. False. the createElement method creates a node, but does not insert it into the DOM tree.
- The setInterval method calls a function repeatedly at a set time interval. True.
- 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.
- 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.
- 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 in each of the following statements.
- The innerHTML property refers to the text inside an element, including XHTML tags.
- A document's DOM tree represents all of the nodes in a document, as well as their relationships to each other.
- The length property contains the number of elements in a collection.
- The item method allows access to an individual element in a collection.
- The images collection contains all the img elements on a page.
- The history object contains information about the sites that a user previously visited.
- CSS properties may be accessed using the style object.
12.8-10 Write a web page that enables the user to play the game of 15.