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

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

主站蜘蛛池模板: 固始县| 淮滨县| 施甸县| 灌阳县| 红原县| 鸡西市| 望都县| 夏河县| 泰兴市| 壶关县| 石泉县| 酉阳| 金湖县| 昌江| 山东| 鄄城县| 海林市| 荣成市| 宁南县| 四会市| 靖安县| 汝阳县| 都兰县| 陕西省| 扎鲁特旗| 北宁市| 聂荣县| 浙江省| 巴楚县| 文登市| 和静县| 南阳市| 蕲春县| 丰台区| 合肥市| 仁化县| 山西省| 雷波县| 韶关市| 亚东县| 沁阳市|