exam questions

Exam 98-382 All Questions

View all questions & answers for the 98-382 exam

Exam 98-382 topic 1 question 4 discussion

Actual exam question from Microsoft's 98-382
Question #: 4
Topic #: 1
[All 98-382 Questions]

HOTSPOT -
You are designing a web page that contains a list of animals. The web page includes a script that outputs animals from a list.
You create the following HTML to test the script:

You need to create a function that will display the list of animals, including any formatting, in the div element.
How should you complete the code? To answer, select the appropriate code segments in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
References: https://www.w3schools.com/jsref/met_element_getelementsbytagname.asp

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
computercat
3 years, 8 months ago
function showList() { var list = document.getElementsByTagName("ul"); for (var i = 0; i < list.length; i++) { document.getElementById("list").innerHTML += list[i].innerHTML; }}
upvoted 2 times
...
w35l3y
3 years, 11 months ago
getElementsByTagName("li") getElementById innerHTML
upvoted 3 times
...
PallaviSos
3 years, 11 months ago
the answer should be document.getElementById("list").innerHTML +=list[i].innerText;
upvoted 3 times
...
ClauDia
3 years, 11 months ago
function showlist(){ var list = document.getElementsByTagName("ul"); console.log(list); for(var i=0; i<list.length; i++){ document.getElementById("list").innerHTML += list[i].innerHTML + "&nbsp;"; } }
upvoted 1 times
...
123nickname123
4 years, 2 months ago
Can someone explain this to me? Why are there two sets of paranthesis one after the other?
upvoted 2 times
...
learning_weber
4 years, 4 months ago
Last Line : document.getElementByTagName("li")("list").innerHTML += list[i].innerText
upvoted 1 times
kimdo7
4 years, 4 months ago
I dont think this is valid *document.getElementByTagName("li")("list").innerHTML*
upvoted 2 times
computercat
3 years, 8 months ago
agree, this doesn't work
upvoted 2 times
...
...
...
ak9797
4 years, 6 months ago
nevermind my comment
upvoted 1 times
...
ak9797
4 years, 6 months ago
the First answer should be getElementsByTagName("li")
upvoted 3 times
kimdo7
4 years, 4 months ago
It is correct because it will give you a list/array of 3 li
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...