exam questions

Exam 98-382 All Questions

View all questions & answers for the 98-382 exam

Exam 98-382 topic 1 question 7 discussion

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

DRAG DROP -
You are creating a web page that requests a username.
You create the following HTML form:

You need to write a function that retrieves the username from the form.
How should you complete the code? To answer, drag the appropriate code segments to the correct locations. Each function may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:
References: https://www.w3schools.com/jsref/coll_doc_forms.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
Rmartinez3ije3232
Highly Voted 4 years, 9 months ago
You should use value instead of innerHTML, because it is an input not a tag value in this case.
upvoted 6 times
...
dev_ash
Most Recent 3 years, 3 months ago
var username = document.forms["credentials"].username.value; or var username = document.forms.credentials.username.value; alert("Welcome " + username)
upvoted 1 times
...
Sathya235
3 years, 7 months ago
var username = document.forms["credentials"].elements[0].value;
upvoted 1 times
...
Sathya235
3 years, 7 months ago
The below two also works var username = document.forms.credentials.username.value; var username = document.forms["credentials"]["username"].value;
upvoted 2 times
...
Sathya235
3 years, 7 months ago
var username = document.getElementById("username").value;
upvoted 1 times
...
PallaviSos
4 years, 1 month ago
The correct answer is : var username = document.forms.credentials.username.value;
upvoted 1 times
...
Ciupaz
4 years, 9 months ago
var username = document.forms["credentials"]["username"].innerHtml;
upvoted 1 times
jp_1
4 years, 7 months ago
var username = document.forms["credentials"]["username"].value;
upvoted 10 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 ...