HTML | Tags and Attributes [FORM] [Select Fields or Option Fields]




Ü How we can include select fields or option fields?
            A select field is a drop down list of options. Consider the following coding,
               <SELECT NAME=”......” SIZE=”....”  MULTIPLE>
              <OPTION VALUE=”.......” SELECTED>--------
              <OPTION VALUE=”......”>---------
              <OPTION VALUE=”......”>---------
              <OPTION VALUE=”......”>---------
              </SELECT>
            First of all we will have to set a <SELECT> tag. In it, we will use the NAME attribute and its value may be any thing we want. The next attribute is SIZE. This is used to define the number of options will be displayed
at a time. If we don’t give any, by default it will display 1 option at a time. Next attribute is MULTIPLE. This attribute is used to let the visitors select more than one option.
            After these, we will put <OPTION> tag for each option we want to use. In it, the first attribute is VALUE. Its value is used for form processing. We can give any thing. After that in the  ---------- position, we will write our option. In one of the <OPTION> tag we can put the SELECTED attribute. Doing so, that option will be displayed as selected by default. Not doing so, the first option will be shown as selected by default. Now consider the following input and output.
Input :
<HTML>
<HEAD>
<TITLE> FORM </TITLE>
</HEAD>
<BODY>
<FORM>
Please rate this site...
<SELECT NAME="FIRST">
<OPTION VALUE="LIKE">I liked it
<OPTION VALUE="GOOD" SELECTED>Yeah, that's good
<OPTION VALUE="GREAT">Great
<OPTION VALUE="Excellent">Excellent..!
</SELECT>
</FORM></BODY>
</HTML>

Output:
When we will click on the drop down arrow in the option list or select field, it will show all the options as follows





When we will give the attribute SIZE in the <SELECT> tag like the following in the above sample code,
            <SELECT NAME=”FIRST” SIZE=2>
Then the output will be as the following





This is the use of the SIZE attribute

Recommended Recommends

Comments

Contact Us

Loading...