Unlock access to all the studying documents.
View Full Document
Unit M Programming Web Pages with JavaScript
1. To retrieve data from or make changes to a web page element, you must first write code that identifies the specific
object you want to work with.
2. Method names are always followed by quotation marks.
3. The value property refers to the current value of a form field or an object property.
4. The addEventListener method is commonly used to access the element specified by a CSS selector.
5. Whenever you use a method, you specify its parent object first, followed by a space and then the method name.
6. You can use browser developer tools to enter test code and view error messages related to JavaScript.
Unit M Programming Web Pages with JavaScript
7. The assignment operator is simply a question mark (?).
8. It’s common to store object references as variables.
9. JavaScript names can include spaces.
10. The contents of a function are executed automatically when they are parsed by a browser.
11. You can think of the DOM as a hierarchical arrangement of the content of an HTML document into a tree-like
structure, which is known as a DOM root. _________________________
12. In the DOM, each HTML element is considered a(n) property. _________________________
13. You can access any HTML element by specifying a CSS selector using the querySelector() method.
_________________________
14. A(n) property is a JavaScript instruction that performs an action. _________________________
15. The script element is added to an HTML document to reference an external JavaScript file.
_________________________
16. To create a variable, you use the keyword create._________________________
17. To call a function in response to a user action, a developer creates a(n) object listener. _________________________
18. The submit event takes place when a user clicks or touches an element. _________________________
19. A common method for changing an element’s CSS styles in response to a user’s actions is to add or remove ID values
from the element in response to events. _________________________
20. JavaScript supports the use of symbols known as operators to compare or change the values of multiple objects or
properties._________________________
21. Writing code to look up and change data associated with parts of HTML documents requires a standardized way of
referring to the parts of a Web page; this system is known as the Document _________ Model.
Unit M Programming Web Pages with JavaScript
22. Standard ____ for objects include the text content associated with an object, the name of the object, and the name of
an associated attribute.
23. The DOM defines ____, which are actions that are associated with an object.
24. You can access any HTML element by specifying a CSS selector using the ____ method.
25. The __________ property refers to the current value of a form field or an object property.
26. The __________ object is the parent element of the DOM tree.
27. Whenever you use a method, you specify its parent object first, followed by a(n) __________ and then the method
name.
Unit M Programming Web Pages with JavaScript
28. You specify a CSS selector in __________ within the parentheses of the querySelector() method to reference
an object.
29. The __________, which is part of the developer tools in a modern web browser, can be used to enter test code and
view error message related to JavaScript.
30. Multi-line comments in JavaScript use the same format as __________ comments.
31. A(n) __________ is a JavaScript instruction that performs an action.
32. To assign a new property value, you use the assignment operator, which is simply a(n) __________.
33. Every JavaScript statement ends with a(n) __________.
Unit M Programming Web Pages with JavaScript
34. JavaScript allows you to create __________, which are values that are stored and that you can access with a name that
you specify.
35. The statement that creates a variable starts with the keyword __________.
36. The first line of a function begins with the word function, followed by its name and a pair of ____.
37. The punctuation for a function is similar to that of a CSS style rule: an opening ____ goes at the beginning.
38. Developers can write JavaScript that responds to actions, known as __________, which include many actions
commonly performed on a web page.
39. The ____ event occurs when a user clicks or touches an element.
Unit M Programming Web Pages with JavaScript
40. The ____ event occurs when a user moves the mouse pointer over an element or touches an element.
41. To call a function in response to a user action, a developer creates a(n) __________.
42. A common method to change the CSS styles of an element in response to a user’s actions is to add or remove
__________ values from the element in response to events.
43. JavaScript supports the use of symbols known as __________ to compare or change the values of multiple objects or
properties.
44. Using comparison operators, you can create a(n) __________ statement, in which two values are compared and if the
result is true, one or more statements are executed.
Unit M Programming Web Pages with JavaScript
45. Referring to the figure above, what is the role of the three lines of code labeled with the number 1?
46. Referring to the figure above, what is the role of the line of code labeled with the number 2?
47. Referring to the figure above, which of the following is a variable name used in the code shown?
48. Referring to the figure above, which of the following is a function name used in the code shown?
Unit M Programming Web Pages with JavaScript
49. Referring to the figure above, what is the role of the line of code labeled with the number 1?
It creates an event listener.
It is a conditional statement.
50. Referring to the figure above, the word addEventListener is an example of a(n) __________.
51. Referring to the figure above, the code in this figure creates a(n) __________.
52. Referring to the figure above, the code addressState.textContent === “CO” is a(n) __________.
Unit M Programming Web Pages with JavaScript
53. Referring to the figure above, which of the following describes when the statements within the braces are executed?
Only if the expression is true.
Only if the expression is false.
Whether the expression is true or false.
Only in response to an event.
Case-Based Critical Thinking Question
Alicia wants to increase the sizes of images on her website in response to users moving the mouse pointer over them. To
add this feature, she plans to use JavaScript.
54. In Alicia’s JavaScript code, she can refer to a user moving the mouse pointer over an element with the __________
event.
55. Alicia can create code that responds to an event using a(n) __________.
56. Alicia can change the CSS styles of the image with the mouse pointer over it by changing the element’s __________
property with JavaScript to add or remove class values from the element.
57. Alicia can create a set of statements to make the changes to her web page and reference the statements as a single unit
by creating a(n) __________.
Unit M Programming Web Pages with JavaScript
Case-Based Critical Thinking Question
Patrice is creating JavaScript code for her website. Her first task is to reference several HTML elements.
58. Patrice can reference HTML elements in JavaScript using the __________ method.
59. If Patrice follows common practice among JavaScript developers, she will store the HTML element references as
__________.
60. If Patrice wants to reference the content of an object and wants her code to work for users if IE8, she will
use the __________ property.
61. Each item in the DOM tree—including elements, attributes, and text content—is known as a(n) __________.
62. Each DOM node is associated with a standard set of information; each piece of information is known as a(n)
________________.
63. The querySelector() method is a child of the __________ object.
64. When creating a variable name that contains multiple words, it’s common to use __________ case.
65. A function starts with the keyword __________.
66. To execute the contents of a function, you must include a reference to the function name, known as a function
__________, elsewhere in your code.
67. Using comparison operators, you can create a(n) __________ statement, in which two values are compared and if the
result is true, one or more statements are executed.
Match each commonly used JavaScript property with the appropriate description.
68. the path and source filename for an element with a src attribute
1
REFERENCES:
352
Unit M Programming Web Pages with JavaScript
69. the text content of an object, excluding any nested HTML tags
70. the current value of a form field or an object property
71. the content of an object, including any nested HTML tags
72. the value of an element’s class attribute
73. Explain the syntax of a statement that uses the assignment operator.
74. What kind of information can you store in a variable? How are variables useful when creating object references, and
why?
75. Name 3 ways that the punctuation for a function is similar to that of a CSS style rule.
Unit M Programming Web Pages with JavaScript