DOM Objects Worksheet
Question 1
In order to use the document.getElementById() method to 'get a handle' on an element, what attribute must that element have?
the element must have an ID attribute.
Question 2
When you invoke document.getElementById(), you must pass in a string parameter. What does the parameter represent?
the string parameter you pass represents the id attribute of the element you want to select. This method uses the id to locate and return the corresponding DOM element
Question 3
What does the document.getElementById() method return?
The document.getElementById() method returns the element object that matches the specified id.
Question 4
What object is at the top of the DOM? In other words, what DOM object contains all other DOM objects?
The object at the top of the DOM (Document Object Model) is the document object. The document object contains and provides access to all other DOM objects, representing the entire HTML or XML document.
Coding Problems
You'll use the following elements to complete the coding problems:
Problem 1Problem 2
Problem 3
This is myDiv
Problem 4