From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/html/element/select/index.html | 221 +++++++++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 files/zh-cn/web/html/element/select/index.html (limited to 'files/zh-cn/web/html/element/select/index.html') diff --git a/files/zh-cn/web/html/element/select/index.html b/files/zh-cn/web/html/element/select/index.html new file mode 100644 index 0000000000..470f6ec2fa --- /dev/null +++ b/files/zh-cn/web/html/element/select/index.html @@ -0,0 +1,221 @@ +--- +title:

+ +

使用多选的进阶选择

+ +

下面的例子更加复杂,展示了可用在 <select> 元素上的更多功能:

+ +
<label>Please choose one or more pets:
+  <select name="pets" multiple size="4">
+    <optgroup label="4-legged pets">
+      <option value="dog">Dog</option>
+      <option value="cat">Cat</option>
+      <option value="hamster" disabled>Hamster</option>
+    </optgroup>
+    <optgroup label="Flying pets">
+      <option value="parrot">Parrot</option>
+      <option value="macaw">Macaw</option>
+      <option value="albatross">Albatross</option>
+    </optgroup>
+  </select>
+</label>
+
+ +

+ +

你会看见:

+ + + +

技术概览

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
内容分类Flow contentphrasing contentinteractive contentlistedlabelableresettable, and submittable form-associated element
允许的内容Zero or more {{HTMLElement("option")}} or {{HTMLElement("optgroup")}} elements.
标签省略{{no_tag_omission}}
允许的父元素Any element that accepts phrasing content.
Implicit ARIA role{{ARIARole("combobox")}} with no multiple attribute and no size attribute greater than 1, otherwise {{ARIARole("listbox")}}
Permitted ARIA roles{{ARIARole("menu")}} with no multiple attribute and no size attribute greater than 1, otherwise no role permitted
DOM 接口{{domxref("HTMLSelectElement")}}
+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('HTML WHATWG', 'forms.html#the-select-element', '<select>')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'forms.html#the-select-element', '<select>')}}{{Spec2('HTML5 W3C')}}
{{SpecName('HTML4.01', 'interact/forms.html#h-17.6', '<select>')}}{{Spec2('HTML4.01')}}
+ +

浏览器兼容性

+ +
{{Compat("html.elements.select")}}
+ +

参见

+ + -- cgit v1.2.3-54-g00ecf