Home > Articles

  • Print
  • + Share This
This chapter is from the book


The Workshop contains quiz questions and activities to help you solidify your understanding of the material covered. Try to answer all questions before looking at the “Answers” section that follows.


  1. What does the plus sign mean in the following context?

    document.write('This is a text string ' + 'that I have created.');
  2. Which of the following DOM objects never has a parent node?

    1. body

    2. div

    3. document

  3. Which of the following is the correct syntax to get the DOM object for a heading with the identifier heading1?

    1. document.getElementById("heading1")

    2. document.GetElementByID("heading1")

    3. document.getElementsById("heading1")


  1. The plus sign (+) joins two strings together.

  2. C. The document object is the root of the DOM object tree, and has no parent object.

  3. A. getElementById has a lowercase g at the beginning and a lowercase d at the end, contrary to what you might know about normal English grammar. Additionally, the name includes Element (singular) rather than Elements (plural).


  • Modify the Back and Forward example in Listing 6.3 to include a Reload button along with the Back and Forward buttons. (This button would trigger the location.reload() method.)

  • Modify the positioning example in Listings 6.5 and 6.6 to move the square 1 pixel at a time rather than 30 at a time.

  • Add a third check box to Listing 6.7 to allow the paragraph of text to be shown or hidden. You will need to add an id attribute to the <p> tag, add a check box to the form, and add the appropriate lines to the script.

  • + Share This
  • 🔖 Save To Your Account