官术网_书友最值得收藏!

Drop-down lists

Often we need to have visitors make a choice from a list. For this purpose, we can use the <select> element in combination with the <option> tag for every inpidual choice. The text portion of the <option> element is what will be displayed, and the value of the value attribute is what will be passed on for processing. It is very useful to make the first option the one that is not to be chosen, as in the following example:

<select name="colorlist" id="colorlist">
<option value="0">Choose a color</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option disabled value="orange">Orange</option>
</select>

The disabled attribute

Both the <select> and the <option> support disabled in case you want to enable an option (or the entire drop-down list) to be displayed but not selectable.

The selected attribute

If you want to preselect one of the choices, use the selected attribute of <option>.

主站蜘蛛池模板: 淮南市| 元朗区| 巢湖市| 武威市| 烟台市| 龙岩市| 民权县| 桃园县| 新巴尔虎左旗| 绥芬河市| 淮阳县| 遂平县| 新兴县| 安龙县| 上蔡县| 龙岩市| 大荔县| 察隅县| 雷山县| 兴义市| 武川县| 同心县| 宾川县| 东乡县| 濮阳县| 汾阳市| 拉萨市| 喀什市| 昆明市| 奉贤区| 集贤县| 河源市| 新源县| 逊克县| 万宁市| 清远市| 富川| 团风县| 昌都县| 肥乡县| 沅陵县|