Html select、option、optgroup 标签

时间:2021-05-12 02:28:41

Html select 标签

</body>
</html> <!-- select外部下拉选择框、name="xxx"标识后端获取名称 -->
<select name="xxx">
<!-- option内部部下拉选择框包含内容、value="1"标识后端获取值、selected="selected" 默认最先选中 -->
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select> <!-- size="10"排列下拉框大小、multiple="multiple"可以按ctrl多选 -->
<select name="xxx" size="10" multiple="multiple">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select> <!-- size="10"排列下拉框大小、multiple="multiple"可以按ctrl多选 -->
<select name="xxx" size="10" multiple="multiple">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select> <select name="xxx" size="10" multiple="multiple">
<!-- optgroup下拉框组标签、label="一"添加不可点击的组名称 -->
<optgroup label="一">
<option value="1" selected="selected">1</option>
</optgroup>
  <optgroup label="二">
  <option value="2">2</option>
</optgroup>
</select> </body>
</html>

效果



1
2
3


1
2
3


1
2
3

1

  
  
2