diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/htmlinputelement/multiple/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/htmlinputelement/multiple/index.html')
-rw-r--r-- | files/zh-cn/web/api/htmlinputelement/multiple/index.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlinputelement/multiple/index.html b/files/zh-cn/web/api/htmlinputelement/multiple/index.html new file mode 100644 index 0000000000..937c52a93f --- /dev/null +++ b/files/zh-cn/web/api/htmlinputelement/multiple/index.html @@ -0,0 +1,44 @@ +--- +title: HTMLInputElement.multiple +slug: Web/API/HTMLInputElement/multiple +translation_of: Web/API/HTMLInputElement/multiple +--- +<div>{{ APIRef("HTML DOM") }}</div> + +<p><strong><code>HTMLInputElement.multiple</code></strong> 属性表示一个input是否可以有多个值。目前只有火狐支持 <code><input type="file"></code>存有多个值。</p> + +<h2 id="实例">实例</h2> + +<pre class="brush:js">// fileInput is a <input type=file multiple> +let fileInput = document.getElementById('myfileinput'); + +if (fileInput.multiple == true) { + + for (let i = 0; i < fileInput.files.length; i++) { + // Loop fileInput.files + } + +// Only one file available +} else { + let file = fileInput.files.item(0); +} +</pre> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en/DOM/FileList" title="en/DOM/FileList">FileList</a></li> + <li><a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=523771" title="https://bugzilla.mozilla.org/show_bug.cgi?id=523771">Bug 523771</a> - <span class="bz_default_hidden" id="summary_alias_container" style="display: inline;"> <span id="short_desc_nonedit_display">Support <input type=file multiple></span> </span></li> +</ul> + +<h2 id="Specification">Specification</h2> + +<ul> + <li><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-multiple" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#attr-input-multiple">The multiple attribute</a> (HTML 5 working draft)</li> +</ul> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.HTMLInputElement.multiple")}}</p> |