ITSE 1411 Beginning Web
JS Form Button Chapter 5 Discussion
Discussion
  1. Radio Buttons
    • Click on radioButtonsExample.htm
    • View the source.
    • Save in your module4 folder in the public_html folder.
    • Open radioButtonsExample.htm in Komodo Edit.
    • Resize this page on the left of your screen.
    • Resize the radioButtonsExample.htm page on the right of your screen.
    • Explanation of the radio buttons on the radioButtonsExample.htm page
      • When a web page has radio buttons, the intent is that only one button can be selected at a time. Usually, all radio buttons in a group have the same name. However, the difference is that each radio button has a different value.
      • When a radio button is selected the checked attribute is set to true (checked).
      • When no checked attribute is included, then the checked attribute defaults to false.
      • When form elements share the same name, JavaScript creates an array of the elements with the same name.
      • To access one of the radio buttons, you access it in the order that it is defined. For example the checked attribute of the second radio button with the value $40.95 uses:
        • document.forms[0].delivery[1].checked
  2. Check Boxes
    • Click on checkboxExample5thEd.htm
    • View the source.
    • Open checkboxExample5thEd.htm in Komodo Edit.
    • Resize this page on the left of your screen.
    • Resize the checkboxExample.htm page on the right of your screen.
    • Explanation of the check boxes on the checkboxExample.htm page
      • The intent of check boxes is to allow the user to select more than one choice.
      • You can group check boxes by giving each the same name value. But, you can also give each a different name.
      • The checked attribute for checkboxes is the same as the checked attribute for radio buttons.