Title:
JavaScript DOM Objects Worksheet
Updated:
November 16, 2023
Task/Activity:
  1. Questions
  2. JS Coding Problems
A. Questions
  1. What is a node?
Essentially an element of data within the document object. Every attribute, element, and text is a node.
  1. In order to use the document.getElementById() method to 'get a handle' on an element, what attribute must that element have?
It must have an id attribute.
  1. When you invoke document.getElementById(), you must pass in a string parameter. What does the parameter represent?
That parameter represents the id that you are looking for.
  1. What does the document.getElementById() method return?
It returns the HTML element that is identified by that id.
  1. What object is at the top of the DOM? In other words, what DOM object contains all other DOM objects?
I'm uncertain as to whether you are referring to the document node or the window, but the window is above the document.
B. Coding Problems

You'll use the following elements to complete the coding problems:

Problem 1


Problem 2
If you don't see this image, then this worksheet may not be in the proper folder (the JavaScript folder)

Problem 3
This is myDiv


Problem 4

Complete this form, and the program will tell you if you are old enough to vote!