aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/html/element/datalist
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/html/element/datalist
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/html/element/datalist')
-rw-r--r--files/zh-cn/web/html/element/datalist/index.html79
1 files changed, 79 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/element/datalist/index.html b/files/zh-cn/web/html/element/datalist/index.html
new file mode 100644
index 0000000000..37bb8d3607
--- /dev/null
+++ b/files/zh-cn/web/html/element/datalist/index.html
@@ -0,0 +1,79 @@
+---
+title: datalist
+slug: Web/HTML/Element/datalist
+tags:
+ - Element
+ - HTML
+translation_of: Web/HTML/Element/datalist
+---
+<p id="概述"><strong><em>HTML </em><code>&lt;datalist&gt;</code><em>元素</em></strong>包含了一组{{HTMLElement("option")}}元素,这些元素表示其它表单控件可选值.</p>
+
+<p>{{EmbedInteractiveExample("pages/tabbed/datalist.html", "tabbed-standard")}}</p>
+
+<ul class="htmlelt">
+ <li><dfn><a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories" title="HTML/Content_categories">内容范畴</a></dfn><a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">流内容</a>,<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">段落内容</a>。</li>
+ <li><dfn>允许内容</dfn>要么 <a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">段落内容</a> 要么 0个或多个 {{HTMLElement("option")}}元素.</li>
+ <li><dfn>遗漏标签</dfn>{{no_tag_omission}}</li>
+ <li><dfn>允许父级元素</dfn>任何接受<a href="https://developer.mozilla.org/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">段落内容</a>的元素.</li>
+ <li><dfn>Permitted ARIA roles</dfn>None</li>
+ <li><dfn>DOM接口</dfn>{{domxref("HTMLDataListElement")}}</li>
+</ul>
+
+<h2 id="属性">属性</h2>
+
+<p>该元素除了公用的<a href="/zh-cn/HTML/Global_attributes" title="zh-cn/HTML/Global attributes">全局属性</a>之外,没有其他属性。</p>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: html">&lt;label&gt;Choose a browser from this list:
+&lt;input list="browsers" name="myBrowser" /&gt;&lt;/label&gt;
+&lt;datalist id="browsers"&gt;
+  &lt;option value="Chrome"&gt;
+  &lt;option value="Firefox"&gt;
+  &lt;option value="Internet Explorer"&gt;
+  &lt;option value="Opera"&gt;
+  &lt;option value="Safari"&gt;
+&lt;/datalist&gt;</pre>
+
+<h3 id="结果">结果</h3>
+
+<p>{{EmbedLiveSample("示例")}}</p>
+
+<h2 id="Specifications" name="Specifications">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', 'the-button-element.html#the-datalist-element', '&lt;datalist&gt;')}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML5 W3C', 'the-datalist-element.html#the-datalist-element', '&lt;datalist&gt;')}}</td>
+ <td>{{Spec2('HTML5 W3C')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("html.elements.datalist")}}</p>
+
+<h2 id="Polyfill">Polyfill</h2>
+
+<p>以下Polyfill旨在支持旧的或者目前不兼容的浏览器:<a href="https://github.com/mfranzke/datalist-polyfill">datalist-polyfill</a></p>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li class="last">{{ HTMLElement("input") }} 元素,它更特殊的 {{ htmlattrxref("list", "input") }} 属性;</li>
+ <li class="last"> {{ HTMLElement("option") }}元素.</li>
+</ul>