JavaScript Question 14 (1 point) Which of the following statements about check b
ID: 3913020 • Letter: J
Question
JavaScript
Question 14 (1 point)
Which of the following statements about check boxes is true?
Question 14 options:
Each check box must have a unique id attribute.
The name and id attributes of each check box should be set to the same value.
Each check box is independent of the other check boxes on a page.
All of the above.
Save
Question 15 (1 point)
How can you clear a check from a Checkbox object?
Question 15 options:
set its clear property to true
set its checked property to false
set its value property to an empty string
call its blur() method
Save
Question 16 (1 point)
What property of the Radio object is used to determine if a radio button is selected?
Question 16 options:
the value property
the checked property
the selected property
the radio property
Save
Question 17 (1 point)
What property would you use to get the text that has been entered into a text area?
Question 17 options:
value
text
name
string
Save
Question 18 (1 point)
What method would you use to remove the focus from a control?
Question 18 options:
focus()
blur()
remove()
value()
Save
Question 19 (1 point)
What event occurs when the user selects a new item from a select list?
Question 19 options:
click
dblclick
change
select
Save
Question 20 (1 point)
Assuming you have a radio button with an id of “contact_via”, which of the following statements selects that radio button?
Question 20 options:
$("contact_via").selected = true;
$("contact_via").checked = true;
$("contact_via").value = true;
$("contact_via").enabled = true;
Save
Question 21 (1 point)
Why would the following code for a button not send the form data to the server?
<input type="button" value="Register" id="register">
Question 21 options:
The value of the id attribute should be “submit”.
The name attribute is missing.
The value of the type attribute should be “submit”.
The submit attribute is missing.
Save
Question 22 (1 point)
What does the following code do?
$("email").firstChild.nodeValue = "Entry is invalid.";
Question 22 options:
Sets the text for the element with “email” as its id attribute.
Gets the text for the element with “email” as its id attribute.
Sets the text for the first child of the element with “email” as its id attribute.
Sets the text for the next child of the element with “email” as its id attribute.
Save
Question 23 (1 point)
For the following code, an event handler named investmentChange is
var investmentChange = function() {
var years = parseInt( $("years").value );
alert("Years: " + years);
};
window.onload = function() {
$("investment").onchange = investmentChange;
};
Question 23 options:
attached to the onload event of the global window object
attached to the onload event of a control with an id of “investment”
attached to the onchange event of the global window object
attached to the onchange event of a control with an id of “investment”
Save
Question 24 (1 point)
Given HTML that includes the element
<p id = "ship">shipping cost goes here</p>
what will the following code do if the user enters 100 at the prompt?
var getInfo = function() {
var cost = parseFloat(prompt("How much does the item cost?"));
var ship = cost * .06;
document.getElementById("ship").innerHTML="Shipping: $" + ship.toFixed(2);
};
Question 24 options:
It will display “shipping cost goes here Shipping: $6.00” in the <p> element.
It will replace the text in the <p> element with “Shipping: $6.00”.
It will display NaN in the <p> element because the starting text in this element is not a number.
It will calculate the value of the ship variable, but the <p> element will remain unchanged.
Save
Question 25 (1 point)
To view the changes that have been made to the DOM for a page by the JavaScript, you can
Question 25 options:
display the HTML for the page in a browser
display the HTML for the page in Chrome’s Sources panel
display the HTML for the page in Chrome’s Elements panel
none of the above
Save
Question 26 (1 point)
What does the following line of code do?
$("user").innerHTML = "Hello, good friend!";
Question 26 options:
It sets the content of the element with “user” as its id attribute to “Hello, good friend!”
It sets the value property of the element with “user” as its id attribute to “Hello, good friend!”
It gets the content of the element with “user” as its id attribute and appends “Hello, good friend!” to that content.
It gets the value property of the element with “user” as its id attribute and appends “Hello, good friend!” to that property.
Each check box must have a unique id attribute.
The name and id attributes of each check box should be set to the same value.
Each check box is independent of the other check boxes on a page.
All of the above.
Explanation / Answer
Question 15:
Ans) b) set its checked property to false
By setting the checked property to false, we can clear the checked property.
Question 16:
Ans) b) the checked property
The checked property usually returns or sets the check state of the radio button.
Question 17:
Ans) a) Value
The value property is generally used to returns or sets the contents of the testarea.
Question 18:
Ans) b) blur()
Blur() is used to remove the focus or sometimes can be used when elements loses its focus.
Question 19:
Ans) c) the change event
Question 20:
Ans) b) $("contact_via").checked = true;
Question 23:
Ans) d) attached to the onchange event of a control with an id of “investment”
Question 14:
Ans) c) each check box is independent of other check box on a page
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.