From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- files/zh-tw/web/html/element/optgroup/index.html | 161 +++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 files/zh-tw/web/html/element/optgroup/index.html (limited to 'files/zh-tw/web/html/element/optgroup') diff --git a/files/zh-tw/web/html/element/optgroup/index.html b/files/zh-tw/web/html/element/optgroup/index.html new file mode 100644 index 0000000000..5368a72cc0 --- /dev/null +++ b/files/zh-tw/web/html/element/optgroup/index.html @@ -0,0 +1,161 @@ +--- +title: +slug: Web/HTML/Element/optgroup +tags: + - Element + - Forms + - HTML + - Reference + - Web +translation_of: Web/HTML/Element/optgroup +--- +

總覽

+ +

In a Web form, the HTML <optgroup> element  creates a grouping of options within a {{HTMLElement("select")}} element.

+ + + + + + + + + + + + + + + + + + + + + + + + +
Content categoriesNone.
Permitted contentZero or more {{HTMLElement("option")}} elements.
Tag omissionThe start tag is mandatory. The end tag is optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content.
Permitted parent elementsA {{HTMLElement("select")}} element.
DOM interface{{domxref("HTMLOptGroupElement")}}
+ +

{{Note("Optgroup elements may not be nested.")}}

+ +

屬性

+ +

This element includes the global attributes.

+ +
+
{{htmlattrdef("disabled")}}
+
If this Boolean attribute is set, none of the items in this option group is selectable. Often browsers grey out such control and it won't receive any browsing events, like mouse clicks or focus-related ones.
+
{{htmlattrdef("label")}}
+
The name of the group of options, which the browser can use when labeling the options in the user interface. This attribute is mandatory if this element is used.
+
+ +

範例

+ +
<select>
+  <optgroup label="Group 1">
+    <option>Option 1.1</option>
+  </optgroup>
+  <optgroup label="Group 2">
+    <option>Option 2.1</option>
+    <option>Option 2.2</option>
+  </optgroup>
+  <optgroup label="Group 3" disabled>
+    <option>Option 3.1</option>
+    <option>Option 3.2</option>
+    <option>Option 3.3</option>
+  </optgroup>
+</select>
+
+ +

結果

+ +

{{EmbedLiveSample("Example")}}

+ +

規範

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'the-button-element.html#the-optgroup-element', '<optgroup>')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'forms.html#the-optgroup-element', '<optgroup>')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('HTML4.01', 'interact/forms.html#h-17.6', '<optgroup>')}}{{Spec2('HTML4.01')}} 
+ +

瀏覽器相容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
功能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基本1.0{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
功能AndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
基本{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

參見

+ + + +

{{HTMLRef}}

-- cgit v1.2.3-54-g00ecf