1 point What event should be used if you want to validate a text element after the user
has edited the text?
onchange
1 point What event should be used to call an action procedure after a button
is pressed?
onclick
1 point What is the name of the property that points to an object that allows
you to modify attributes of an element such as text color or font size?
style
2 points Suppose you are given the following form:
Write a function called count_amenities that counts and returns the
number of amenities checked by the user. The function takes no arguments.
function count_amenities() {
count = 0;
amenities = ['non-smoking', 'internet', 'jacuzzi', 'microwave', 'refrigerator'];
for (index in amenities) {
count += (document.forms.reservation[amenities[index]].checked) ? 1 : 0;
}
return count;