1. 1 point What event should be used if you want to validate a text element after the user has edited the text?


  2. 1 point What event should be used to call an action procedure after a button is pressed? onclick

  3. 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

  4. 2 points Suppose you are given the following form: <form name="reservation"> <input type="checkbox" name="non-smoking" value="non-smoking"> <input type="checkbox" name="internet" value="internet"> <input type="checkbox" name=jacuzzi" value="jacuzzi"> <input type="checkbox" name="microwave" value="microwave"> <input type="checkbox" name="refrigerator" value="refrigerator"> <input type="submit" name="submit"> </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;