Instructions:


Test Problems

  1. Change the HTML code of this page so that the personal information field names are right-aligned close to the fields.

    Added <colgroup span=1 style="text-align:right;padding-right:4px;" /> right after the table tag.

  2. Add a label that says something like "Personal Information" to the fieldset that surrounds the personal information fields.

    Added <Personal Information</legend> right after the fieldset tag.

  3. Correct the JavaScript code for the radio buttons in the true/false questions so that each of them turns green immediately when the correct answer is selected, and red when the wrong answer is selected.

    For question 1, the text color is controlled with onclick="q1text.style.color='{color}';">
    For question 2, the the background color is controlled with onclick="q2text.style.backgroundColor='{color}';">

    (Note that there is credit for identifying the correct answers, as well as for getting the JavaScript code right.)

    Question 1 is false. The length of the field is the length of the choice list (that is, the number of elements in the list), not the length of the currently selected choice.
    Question 2 is true. Within a form field (e.g. within its event code), the special object this is the same as {formname}.{fieldname}.

  4. Debug the event and JavaScript code so that an alert box pops up saying "Thank you for submitting the form" when the users submits the form.

    The submit button could be modified so that the alert takes place in response to the onclick event; that is, onclick="alert('Thank you for submitting the form');". Or, the event onsubmit="alert('Thank you for submitting the form');" could be added to the form tag.


Personal Information
Name:
Street Address:
City:
State: Zip:
TrueFalse
1.For a selection list field called "country" in a form called "billingform", the expression billingform.country.length represents the length of the selected choice.
2. In a form called orderForm, with fields called firstName and lastName, in the Onchange event for firstName, the following expressions are equivalent:
(this.value == this.form.lastName.value)
(orderForm.firstName.value == orderForm.lastName.value)

Back to Top of Page    |    Class Home Page
4/18/2007 Robin.Richmond@tri-c.edu