Deck 5: Working With the Document Object Model Dom and Dhtml
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/41
Play
Full screen (f)
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()
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) 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 " )
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
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()
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
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()
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
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
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" )
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
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()
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()
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
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()
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
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()
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
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
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()
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
A) getElementsByTagName("first")
B) getElementById("first")
C) querySelectorAll("first")
D) getElementsByClassName("first")
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