Page 88 - CodePilot V5.0 C8
P. 88

The following code snippet uses the <INPUT> tag with TYPE=“RADIO” to display a radio button:

                  <LABEL>Gender:</LABEL>
                  <INPUT TYPE="RADIO" ID="male" NAME="Gender" VALUE="Male" CHECKED>

                  <LABEL FOR="male">Male</LABEL>
                  <INPUT TYPE="RADIO" ID="female" NAME="Gender" VALUE="Female">

                  <LABEL FOR="female">Female</LABEL>
                  The CHECKED attribute selects the specific radio button by default. Here, “Male” radio button is
                  checked by default.
                  The output of the preceding code is as follows:




                                                                                                            Scan the QR
                                                                                                            for full code







                  Adding Checkbox

                  A checkbox is like a toggle switch, allowing users to select multiple options by clicking on them.
                  The checkbox can be selected by default using the CHECKED attribute.

                  The syntax to add the checkbox  button in the form is as follows:

                  <INPUT TYPE="CHECKBOX" NAME="Name of checkbox" VALUE="value of checkbox">
                  The following code snippet uses the <INPUT> tag with TYPE=“CHECKBOX” to display a checkbox:

                  Select Your Favourite Sports<BR>
                  <INPUT TYPE="checkbox" ID="football" NAME="sports" VALUE="Football">

                  <LABEL FOR="football">Football</LABEL><BR>
                  <INPUT TYPE="checkbox" ID="cricket" NAME="sports" VALUE="Cricket">

                  <LABEL FOR="cricket">Cricket</LABEL><BR>
                  <INPUT TYPE="checkbox" ID="hockey" NAME="sports" VALUE="Hockey">
                  <LABEL FOR="hockey">Hockey</LABEL><BR>

                  The output of the preceding code is as follows:



                                                                                                            Scan the QR
                                                                                                            for full code













                   86
                        CodePilot (V5.0)-VIII
   83   84   85   86   87   88   89   90   91   92   93