Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 87 - 2620_Birla Open Mind C-8
P. 87

    To add the radio button in the form, follow the syntax as given below:

                     <INPUT TYPE= “RADIO” NAME=“Name  of the radio button” VALUE=“value  of radio
                     button” CHECKED>
                     For example:

                     <INPUT TYPE= “RADIO” NAME=“Gender” VALUE=“Male” CHECKED> Male

                     <INPUT TYPE=“RADIO” NAME=“Gender” VALUE=“Female”> Female
                     TYPE=“RADIO” indicates that the form element is radio button.

                     NAME=“Gender” is the name of the radio button group.

                     VALUE=“Male” and VALUE=“Female” signifies that one radio button has value “Male” and the other has
                     the value=“Female”.

                     CHECKED attribute selects the specific radio button by default. Here, ‘Male’ radio button is checked by
                     default.
                     Let us create a web page to display the radio button.

                     <!DOCTYPE html>
                     <HTML>

                     <BODY>

                     <FORM>
                     Gender:

                     <INPUT TYPE="RADIO" NAME="Gender" VALUE="Male" CHECKED> Male

                     <INPUT TYPE="RADIO" NAME="Gender" VALUE="Female"> Female
                     </FORM>

                     </BODY>

                     </HTML>
                     Adding Check Box

                     A checkbox is like a toggle switch where users can select a desired multiple choices by clicking on the
                     check box.

                     To add the check box in the form, follow the syntax as given below:

                     <INPUT TYPE=“CHECKBOX” NAME=“Name of check box” VALUE=“value of check box”>
                     For example:

                     <INPUT TYPE="CHECKBOX" NAME="Hobbies" VALUE="Reading" CHECKED>
                     TYPE=“CHECKBOX” indicates that the form element is check box.
                     NAME=“Hobbies” is the name of the check box.

                     VALUE=“Reading” is the default value of check box.

                     CHECKED attribute selects the specific check box by default.

                                                                                                      #Forms in HTML5  85

| 82 83 84 85 86 87 88 89 90 91 92 |