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/htmlformelement/elements | |
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/htmlformelement/elements')
-rw-r--r-- | files/zh-cn/web/api/htmlformelement/elements/index.html | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/htmlformelement/elements/index.html b/files/zh-cn/web/api/htmlformelement/elements/index.html new file mode 100644 index 0000000000..ebb26003b0 --- /dev/null +++ b/files/zh-cn/web/api/htmlformelement/elements/index.html @@ -0,0 +1,22 @@ +--- +title: HTMLFormElement.elements +slug: Web/API/HTMLFormElement/elements +translation_of: Web/API/HTMLFormElement/elements +--- +<div> + <span style="font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 30px;">小结</span></div> +<p><strong>elements</strong> 返回一个 {{domxref("HTMLFormControlsCollection")}} ({{ HTMLVersionInline(4) }} <code><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-75708506">HTMLCollection</a></code>) 其中包含FORM的所有控件。需要注意的是,其中不包括<code><code style="font-size: 14px;">type等于</code></code><span style="font-family: 'Courier New', 'Andale Mono', monospace; line-height: normal;">image的</span><code style="font-size: 14px;"><a href="/en-US/docs/HTML/Element/Input" title="input">input</a></code><span style="line-height: 1.5;"> 元素。</span></p> +<p>你可以通过 <a href="/en-US/docs/DOM/element.name" title="DOM/element.name">name</a> 或 <a href="/en-US/docs/DOM/element.id" title="DOM/element.id">id</a>来访问对应的控件。</p> +<h2 id="Syntax" name="Syntax">语法</h2> +<pre class="syntaxbox"><em>nodeList</em> = <em>HTMLFormElement</em>.elements +</pre> +<h2 id="Example" name="Example">实例</h2> +<pre class="brush:js">var inputs = document.getElementById("form1").elements; +var inputByIndex = inputs[2]; +var inputByName = inputs["login"]; +</pre> +<h2 id="Specification" name="Specification">规范</h2> +<ul> + <li><a class="external" href="http://www.w3.org/TR/html5/forms.html#dom-form-elements" title="http://www.w3.org/TR/html5/forms.html#dom-form-elements">HTML5, Section 4.10.3, The form Element</a></li> + <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-76728479">DOM Level 2 HTML: elements</a></li> +</ul> |