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

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>.

主站蜘蛛池模板: 洛浦县| 青阳县| 改则县| 扎囊县| 镇江市| 湖南省| 海口市| 左贡县| 潼南县| 西昌市| 疏附县| 凤庆县| 商丘市| 田东县| 鸡西市| 辽源市| 青田县| 平顶山市| 巴东县| 浦东新区| 始兴县| 平定县| 皮山县| 永春县| 开鲁县| 岑溪市| 赤城县| 安西县| 延长县| 百色市| 大邑县| 淮阳县| 中西区| 洛浦县| 桐乡市| 资阳市| 淳安县| 肃北| 壶关县| 丰顺县| 澄城县|