Deck 5: Working With the Document Object Model Dom and Dhtml

Full screen (f)
exit full mode
Question
A node attached with the appendChild()method is always added as the last child element of the parent element.
Use Space or
up arrow
down arrow
to flip the card.
Question
The ____ method is used to cancel a setTimeout()method before its code executes.

A) stopTimeout()
B) cancelTimeout()
C) clearInterval()
D) clearTimeout()
Question
The History object contains a single property, the ____ property, which contains the specific number of documents that have been opened during the current browser session.

A) length
B) size
C) list
D) index
Question
The getElementsBySelector()method returns a collection of elements matching a specified selector.
Question
Which method returns all   elements in a document that match the selector p figure img ?

A) getElementsByTagName( "p figure img" )
B)getElementsByName( "p figure img" )
C)querySelector( " p figure img " )
D)querySelectorAll( " p figure img " )
Question
Which results in a node that exists independently of the DOM tree?

A) appendChild()
B)createElement()
C)insertBefore()
D)setting the value of a variable referencing an independent node to null
Question
Which method does NOT return a node list or HTML collection?

A) getElementById()
B) getElementsByTagName()
C)getElementsByClassName()
D)getElementsByName()
Question
When you open a new web browser window, you can customize its appearance using the ____ argument of the window.open()method.

A) url
B) name
C) options
D) replace
Question
The ____ method repeatedly executes the same code after being called only once.

A) setInterval()
B) loadInterval()
C) startInterval()
D) clearInterval()
Question
Internet Explorer 8 does not support the textContent property.
Question
The objects in the BOM for any given web page depend on the contents of the page.
Question
Which is the correct way to reference the href attribute of the element with the id value homeLink ?

A) document.getElementById("homeLink").style.href
B) document.getElementById("homeLink").attr.href
C) document.getElementById("homeLink").attr("href")
D) document.getElementById("homeLink").href
Question
Which is the correct way to reference the CSS  font-family property in JavaScript when using dot notation?

A) font-family
B) fontfamily
C) fontFamily
D)font.family
Question
The top-level object in the browser object model is the Window object, which represents a web browser window.
Question
Which method returns all h1 elements in a document?

A) getElementById("h1")
B) getElementsByTagName( "h1" )
C)getElementsByClassName( "h1" )
D)getElementsByName( "h1" )
Question
The ____ object is used to obtain information about the current web browser.

A) Location
B) Navigator
C) History
D) Browser
Question
The ____ method is used in JavaScript to execute code after a specific amount of time has elapsed.

A) clearInterval()
B) clearTimeout()
C) setTimeout()
D) startTimeout()
Question
In order to make a window the active window, you use the ____ method of the Window object.

A) open()
B) set()
C) focus()
D) active()
Question
The ____ object allows you to change to a new web page from within JavaScript code.

A) Navigator
B) Browser
C) History
D) Location
Question
The ____ method is used to clear a setInterval()method call.

A) exitInterval()
B) stopInterval()
C) clearInterval()
D) cancelInterval()
Question
Match between columns
Represents the web page displayed in the browser
client-side object model
Represents the web page displayed in the browser
Document object
Represents the web page displayed in the browser
appendChild method
Represents the web page displayed in the browser
node
Represents the web page displayed in the browser
getElementsByClassName() method
Represents the web page displayed in the browser
HTML collection
Represents the web page displayed in the browser
querySelectorAll() method
Represents the web page displayed in the browser
document fragment
Represents the web page displayed in the browser
self.close()
Represents the web page displayed in the browser
History object
Attaches a node to the DOM tree
client-side object model
Attaches a node to the DOM tree
Document object
Attaches a node to the DOM tree
appendChild method
Attaches a node to the DOM tree
node
Attaches a node to the DOM tree
getElementsByClassName() method
Attaches a node to the DOM tree
HTML collection
Attaches a node to the DOM tree
querySelectorAll() method
Attaches a node to the DOM tree
document fragment
Attaches a node to the DOM tree
self.close()
Attaches a node to the DOM tree
History object
References elements using the syntax of CSS
client-side object model
References elements using the syntax of CSS
Document object
References elements using the syntax of CSS
appendChild method
References elements using the syntax of CSS
node
References elements using the syntax of CSS
getElementsByClassName() method
References elements using the syntax of CSS
HTML collection
References elements using the syntax of CSS
querySelectorAll() method
References elements using the syntax of CSS
document fragment
References elements using the syntax of CSS
self.close()
References elements using the syntax of CSS
History object
References elements using the value of the HTML class attribute
client-side object model
References elements using the value of the HTML class attribute
Document object
References elements using the value of the HTML class attribute
appendChild method
References elements using the value of the HTML class attribute
node
References elements using the value of the HTML class attribute
getElementsByClassName() method
References elements using the value of the HTML class attribute
HTML collection
References elements using the value of the HTML class attribute
querySelectorAll() method
References elements using the value of the HTML class attribute
document fragment
References elements using the value of the HTML class attribute
self.close()
References elements using the value of the HTML class attribute
History object
Closes the current window
client-side object model
Closes the current window
Document object
Closes the current window
appendChild method
Closes the current window
node
Closes the current window
getElementsByClassName() method
Closes the current window
HTML collection
Closes the current window
querySelectorAll() method
Closes the current window
document fragment
Closes the current window
self.close()
Closes the current window
History object
Nodes that are not part of a document
client-side object model
Nodes that are not part of a document
Document object
Nodes that are not part of a document
appendChild method
Nodes that are not part of a document
node
Nodes that are not part of a document
getElementsByClassName() method
Nodes that are not part of a document
HTML collection
Nodes that are not part of a document
querySelectorAll() method
Nodes that are not part of a document
document fragment
Nodes that are not part of a document
self.close()
Nodes that are not part of a document
History object
Maintains an internal list of all the documents that have been opened during the current web browser session
client-side object model
Maintains an internal list of all the documents that have been opened during the current web browser session
Document object
Maintains an internal list of all the documents that have been opened during the current web browser session
appendChild method
Maintains an internal list of all the documents that have been opened during the current web browser session
node
Maintains an internal list of all the documents that have been opened during the current web browser session
getElementsByClassName() method
Maintains an internal list of all the documents that have been opened during the current web browser session
HTML collection
Maintains an internal list of all the documents that have been opened during the current web browser session
querySelectorAll() method
Maintains an internal list of all the documents that have been opened during the current web browser session
document fragment
Maintains an internal list of all the documents that have been opened during the current web browser session
self.close()
Maintains an internal list of all the documents that have been opened during the current web browser session
History object
Also known as the browser object model (BOM)
client-side object model
Also known as the browser object model (BOM)
Document object
Also known as the browser object model (BOM)
appendChild method
Also known as the browser object model (BOM)
node
Also known as the browser object model (BOM)
getElementsByClassName() method
Also known as the browser object model (BOM)
HTML collection
Also known as the browser object model (BOM)
querySelectorAll() method
Also known as the browser object model (BOM)
document fragment
Also known as the browser object model (BOM)
self.close()
Also known as the browser object model (BOM)
History object
Indexed collection of HTML elements
client-side object model
Indexed collection of HTML elements
Document object
Indexed collection of HTML elements
appendChild method
Indexed collection of HTML elements
node
Indexed collection of HTML elements
getElementsByClassName() method
Indexed collection of HTML elements
HTML collection
Indexed collection of HTML elements
querySelectorAll() method
Indexed collection of HTML elements
document fragment
Indexed collection of HTML elements
self.close()
Indexed collection of HTML elements
History object
Each item in the DOM tree
client-side object model
Each item in the DOM tree
Document object
Each item in the DOM tree
appendChild method
Each item in the DOM tree
node
Each item in the DOM tree
getElementsByClassName() method
Each item in the DOM tree
HTML collection
Each item in the DOM tree
querySelectorAll() method
Each item in the DOM tree
document fragment
Each item in the DOM tree
self.close()
Each item in the DOM tree
History object
Question
Name two ways to add a node to the DOM, and explain when you'd use each.
Question
The ____________________ object represents a web browser window.
Question
The first h2 element in a web page is created with the following tag pair:

. Provide three different examples of code to reference this element using three different methods.
Question
Which method returns a single element?

A)getElementsByTagName()
B)getElementsByClassName()
C)querySelector()
D)querySelectorAll()
Question
Explain the relationship between the Window object and the  Document object.
Question
How can you control a new window from the browser window that created it?
Question
The DOM hierarchy is also known as ____.

A) the API
B) the node
C) theDOM tree
D)DHTML
Question
A set of connected nodes that are not part of a document is known as a(n)____.

A)node list
B) document fragment
C)HTML collection
D)array
Question
Which method adds a node to a parent node before one or more existing child nodes?

A) appendChild()
B)createElement()
C)insertBefore()
D)cloneNode()
Question
How can you center a web browser window in the middle of the display area?
Question
One way of referring to the Window object is by using the ____________________ property, which refers to the current Window object.
Question
Describe the differences between the  setTimeout() and setInterval()methods, and specify the method you use to cancel each.
Question
Is the Navigator object commonly used in determining which type of browser a user is running? Why or why not?
Question
What is the difference in syntax between referencing a CSS property of an element and referencing an attribute of an element? Give an example of each.
Question
What is the difference between the content accessed by the textContent and innerHTML properties?
Question
Which method returns the element created by the HTML tag pair

P1P1_E?


A) getElementsByTagName("first")
B) getElementById("first")
C) querySelectorAll("first")
D) getElementsByClassName("first")
Question
Each item in the DOM tree is known as a(n)____________________ .
Question
For security reasons, you should use the ____________________ property when possible instead of the innerHTML property.
Question
The Document object branch of the browser object model is represented by its own object model called the ______________________________.
Question
Can you use JavaScript access URLs contained in the History object? If yes, provide code to do so. If no, why not?
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/41
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 5: Working With the Document Object Model Dom and Dhtml
1
A node attached with the appendChild()method is always added as the last child element of the parent element.
True
2
The ____ method is used to cancel a setTimeout()method before its code executes.

A) stopTimeout()
B) cancelTimeout()
C) clearInterval()
D) clearTimeout()
D
3
The History object contains a single property, the ____ property, which contains the specific number of documents that have been opened during the current browser session.

A) length
B) size
C) list
D) index
A
4
The getElementsBySelector()method returns a collection of elements matching a specified selector.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
5
Which method returns all   elements in a document that match the selector p figure img ?

A) getElementsByTagName( "p figure img" )
B)getElementsByName( "p figure img" )
C)querySelector( " p figure img " )
D)querySelectorAll( " p figure img " )
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
6
Which results in a node that exists independently of the DOM tree?

A) appendChild()
B)createElement()
C)insertBefore()
D)setting the value of a variable referencing an independent node to null
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
7
Which method does NOT return a node list or HTML collection?

A) getElementById()
B) getElementsByTagName()
C)getElementsByClassName()
D)getElementsByName()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
8
When you open a new web browser window, you can customize its appearance using the ____ argument of the window.open()method.

A) url
B) name
C) options
D) replace
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
9
The ____ method repeatedly executes the same code after being called only once.

A) setInterval()
B) loadInterval()
C) startInterval()
D) clearInterval()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
10
Internet Explorer 8 does not support the textContent property.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
11
The objects in the BOM for any given web page depend on the contents of the page.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
12
Which is the correct way to reference the href attribute of the element with the id value homeLink ?

A) document.getElementById("homeLink").style.href
B) document.getElementById("homeLink").attr.href
C) document.getElementById("homeLink").attr("href")
D) document.getElementById("homeLink").href
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
13
Which is the correct way to reference the CSS  font-family property in JavaScript when using dot notation?

A) font-family
B) fontfamily
C) fontFamily
D)font.family
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
14
The top-level object in the browser object model is the Window object, which represents a web browser window.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
15
Which method returns all h1 elements in a document?

A) getElementById("h1")
B) getElementsByTagName( "h1" )
C)getElementsByClassName( "h1" )
D)getElementsByName( "h1" )
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
16
The ____ object is used to obtain information about the current web browser.

A) Location
B) Navigator
C) History
D) Browser
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
17
The ____ method is used in JavaScript to execute code after a specific amount of time has elapsed.

A) clearInterval()
B) clearTimeout()
C) setTimeout()
D) startTimeout()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
18
In order to make a window the active window, you use the ____ method of the Window object.

A) open()
B) set()
C) focus()
D) active()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
19
The ____ object allows you to change to a new web page from within JavaScript code.

A) Navigator
B) Browser
C) History
D) Location
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
20
The ____ method is used to clear a setInterval()method call.

A) exitInterval()
B) stopInterval()
C) clearInterval()
D) cancelInterval()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
21
Match between columns
Represents the web page displayed in the browser
client-side object model
Represents the web page displayed in the browser
Document object
Represents the web page displayed in the browser
appendChild method
Represents the web page displayed in the browser
node
Represents the web page displayed in the browser
getElementsByClassName() method
Represents the web page displayed in the browser
HTML collection
Represents the web page displayed in the browser
querySelectorAll() method
Represents the web page displayed in the browser
document fragment
Represents the web page displayed in the browser
self.close()
Represents the web page displayed in the browser
History object
Attaches a node to the DOM tree
client-side object model
Attaches a node to the DOM tree
Document object
Attaches a node to the DOM tree
appendChild method
Attaches a node to the DOM tree
node
Attaches a node to the DOM tree
getElementsByClassName() method
Attaches a node to the DOM tree
HTML collection
Attaches a node to the DOM tree
querySelectorAll() method
Attaches a node to the DOM tree
document fragment
Attaches a node to the DOM tree
self.close()
Attaches a node to the DOM tree
History object
References elements using the syntax of CSS
client-side object model
References elements using the syntax of CSS
Document object
References elements using the syntax of CSS
appendChild method
References elements using the syntax of CSS
node
References elements using the syntax of CSS
getElementsByClassName() method
References elements using the syntax of CSS
HTML collection
References elements using the syntax of CSS
querySelectorAll() method
References elements using the syntax of CSS
document fragment
References elements using the syntax of CSS
self.close()
References elements using the syntax of CSS
History object
References elements using the value of the HTML class attribute
client-side object model
References elements using the value of the HTML class attribute
Document object
References elements using the value of the HTML class attribute
appendChild method
References elements using the value of the HTML class attribute
node
References elements using the value of the HTML class attribute
getElementsByClassName() method
References elements using the value of the HTML class attribute
HTML collection
References elements using the value of the HTML class attribute
querySelectorAll() method
References elements using the value of the HTML class attribute
document fragment
References elements using the value of the HTML class attribute
self.close()
References elements using the value of the HTML class attribute
History object
Closes the current window
client-side object model
Closes the current window
Document object
Closes the current window
appendChild method
Closes the current window
node
Closes the current window
getElementsByClassName() method
Closes the current window
HTML collection
Closes the current window
querySelectorAll() method
Closes the current window
document fragment
Closes the current window
self.close()
Closes the current window
History object
Nodes that are not part of a document
client-side object model
Nodes that are not part of a document
Document object
Nodes that are not part of a document
appendChild method
Nodes that are not part of a document
node
Nodes that are not part of a document
getElementsByClassName() method
Nodes that are not part of a document
HTML collection
Nodes that are not part of a document
querySelectorAll() method
Nodes that are not part of a document
document fragment
Nodes that are not part of a document
self.close()
Nodes that are not part of a document
History object
Maintains an internal list of all the documents that have been opened during the current web browser session
client-side object model
Maintains an internal list of all the documents that have been opened during the current web browser session
Document object
Maintains an internal list of all the documents that have been opened during the current web browser session
appendChild method
Maintains an internal list of all the documents that have been opened during the current web browser session
node
Maintains an internal list of all the documents that have been opened during the current web browser session
getElementsByClassName() method
Maintains an internal list of all the documents that have been opened during the current web browser session
HTML collection
Maintains an internal list of all the documents that have been opened during the current web browser session
querySelectorAll() method
Maintains an internal list of all the documents that have been opened during the current web browser session
document fragment
Maintains an internal list of all the documents that have been opened during the current web browser session
self.close()
Maintains an internal list of all the documents that have been opened during the current web browser session
History object
Also known as the browser object model (BOM)
client-side object model
Also known as the browser object model (BOM)
Document object
Also known as the browser object model (BOM)
appendChild method
Also known as the browser object model (BOM)
node
Also known as the browser object model (BOM)
getElementsByClassName() method
Also known as the browser object model (BOM)
HTML collection
Also known as the browser object model (BOM)
querySelectorAll() method
Also known as the browser object model (BOM)
document fragment
Also known as the browser object model (BOM)
self.close()
Also known as the browser object model (BOM)
History object
Indexed collection of HTML elements
client-side object model
Indexed collection of HTML elements
Document object
Indexed collection of HTML elements
appendChild method
Indexed collection of HTML elements
node
Indexed collection of HTML elements
getElementsByClassName() method
Indexed collection of HTML elements
HTML collection
Indexed collection of HTML elements
querySelectorAll() method
Indexed collection of HTML elements
document fragment
Indexed collection of HTML elements
self.close()
Indexed collection of HTML elements
History object
Each item in the DOM tree
client-side object model
Each item in the DOM tree
Document object
Each item in the DOM tree
appendChild method
Each item in the DOM tree
node
Each item in the DOM tree
getElementsByClassName() method
Each item in the DOM tree
HTML collection
Each item in the DOM tree
querySelectorAll() method
Each item in the DOM tree
document fragment
Each item in the DOM tree
self.close()
Each item in the DOM tree
History object
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
22
Name two ways to add a node to the DOM, and explain when you'd use each.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
23
The ____________________ object represents a web browser window.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
24
The first h2 element in a web page is created with the following tag pair:

. Provide three different examples of code to reference this element using three different methods.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
25
Which method returns a single element?

A)getElementsByTagName()
B)getElementsByClassName()
C)querySelector()
D)querySelectorAll()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
26
Explain the relationship between the Window object and the  Document object.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
27
How can you control a new window from the browser window that created it?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
28
The DOM hierarchy is also known as ____.

A) the API
B) the node
C) theDOM tree
D)DHTML
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
29
A set of connected nodes that are not part of a document is known as a(n)____.

A)node list
B) document fragment
C)HTML collection
D)array
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
30
Which method adds a node to a parent node before one or more existing child nodes?

A) appendChild()
B)createElement()
C)insertBefore()
D)cloneNode()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
31
How can you center a web browser window in the middle of the display area?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
32
One way of referring to the Window object is by using the ____________________ property, which refers to the current Window object.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
33
Describe the differences between the  setTimeout() and setInterval()methods, and specify the method you use to cancel each.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
34
Is the Navigator object commonly used in determining which type of browser a user is running? Why or why not?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
35
What is the difference in syntax between referencing a CSS property of an element and referencing an attribute of an element? Give an example of each.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
36
What is the difference between the content accessed by the textContent and innerHTML properties?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
37
Which method returns the element created by the HTML tag pair

P1P1_E?


A) getElementsByTagName("first")
B) getElementById("first")
C) querySelectorAll("first")
D) getElementsByClassName("first")
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
38
Each item in the DOM tree is known as a(n)____________________ .
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
39
For security reasons, you should use the ____________________ property when possible instead of the innerHTML property.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
40
The Document object branch of the browser object model is represented by its own object model called the ______________________________.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
41
Can you use JavaScript access URLs contained in the History object? If yes, provide code to do so. If no, why not?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 41 flashcards in this deck.