Back to Archive
Computer Science
QID: #35454
Subject: Computer Science
Status: Verified Solution Available
1) Assuming you have a radio button with an id of “contact_via”, which of the following statements selects that radio button?
$("contact_via").selected = true;
$("contact_via").checked = true;
$("contact_via").value = true;
$("contact_via").enabled = true;
2. Why would the following code for a button not send the form data to the server?
<input type="button" value="Register" id="register">
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.
3. What does the following code do?
$("email").firstChild.nodeValue = "Entry is invalid.";
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.
4. 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;
};
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”
5. 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);
};
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.
6. To view the changes that have been made to the DOM for a page by the JavaScript, you can
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
7. What does the following line of code do?
$("user").innerHTML = "Hello, good friend!";
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.
ZERO AI
Human Written
Human Written
PHD EXPERTS
Verified
Verified
TURNITIN
Clean Report
Clean Report
24/7 SUPPORT
Instant Help
Instant Help