Hybrid 6 cont. Flashcards

1
Q

<ul>
<li> id="item-1">HTML for content</li>
<li> id="item-2">CSS for presentation</li>
<li> id="item-3">JavaScript for functionality</li>
</ul>

How can we select all the li elements?

A

document.getElementsByTagName(“li”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

T/F - getElementbyClassName() and getElementsByTagName() return an array-like list of the matched elements even if the match is for a single element

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

document.getElementsByClassName(“test”).innerHTML= “Hello”;

Will change what?

A

THe first element that has the class name “test”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T/F - JavaScript only provides one way to add Event Listeners to Elements

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you retrieve an element with the id “first”? 2 ways

A

document.querySelector(#first)
document.getElementById(“first”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

T/F - Scripting languages can accomplish tasks quickly without concern for machine efficiency because it is interpretable and dynamically typed language

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the first step in adding event handling to your JavaScript code?

A

Identifying the DOM node the interactive behaviour will be attached to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

IF your html code cotains the follow element:

<p> The quick brown fox jumped the fence </p>

The following javascript code will change the color of the paragraph to red?

document.fox.style.color = “red”;

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly