How to create drop-down Selection List ?

Basics of HTML

Create drop-down Selection List ?

Lists with radio buttons or checkboxes are fine for short lists. You can make big list with either of those. But there are situations where you want to show hundreds of options and select only one, Like in a form where you want to choose a state or a country. You have probably seen dozens of those. In such cases a drop-down list may be better. It keeps the form very compact and you can easily see what country or state you have selected.

Lists like these are created with the SELECT tag. There is an opening tag and a closing one. You need to specify a name with the NAME attribute.

<SELECT NAME="country"></SELECT>

The options in the list are created with the OPTION tag. The closing tag is optional. The VALUE attribute is optional; you can leave it out. If you don't use it, the value after the OPTION tag is submitted with the form. If you use the VALUE attribute, only the value is submitted.

Code :-

<SELECT NAME="country"><OPTION VALUE=" "> (select country) </OPTION><OPTION VALUE="AF"> Afghanistan </OPTION><OPTION VALUE="AL"> Albania </OPTION></SELECT>


# What is Visual basic?

In a list like the one above, the first one is selected by default. The value would be empty here. If you suspect that most of your visitors are from Afghanistan, you can set that as the default by moving it to the first place. You can also use the SELECTED attribute to do so. You can leave the first option (select country) out.

Code :-