From b9afb23d12dcae1e09f8d04c72143c5ddaa34aea Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 16 Jul 2021 16:27:00 -0400 Subject: delete conflicting/orphaned docs (zh-CN) (#1412) * delete conflicting docs (zh-CN) * and redirects * do orphaned as well * fix * remove more orphans * revert orphaned docs that can identify origin * move orphaned docs to current loc * adjust slug path * fix redirect change from rebase Co-authored-by: Irvin --- files/zh-cn/conflicting/web/api/index.html | 72 ------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 files/zh-cn/conflicting/web/api/index.html (limited to 'files/zh-cn/conflicting/web/api/index.html') diff --git a/files/zh-cn/conflicting/web/api/index.html b/files/zh-cn/conflicting/web/api/index.html deleted file mode 100644 index 333f98f0a4..0000000000 --- a/files/zh-cn/conflicting/web/api/index.html +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: Element.name -slug: conflicting/Web/API -translation_of: Web/API -translation_of_original: Web/API/Element/name -original_slug: Web/API/Element/name ---- -

{{ APIRef() }}

- -

概述

- -

name 获取或设置一个 DOM 对象的 name 属性;它只能应用于下列元素:{{ HTMLelement("a") }}, {{ HTMLelement("applet") }}, {{ HTMLelement("button") }}, {{ HTMLelement("form") }}, {{ HTMLelement("frame") }}, {{ HTMLelement("iframe") }}, {{ HTMLelement("img") }}, {{ HTMLelement("input") }}, {{ HTMLelement("map") }}, {{ HTMLelement("meta") }}, {{ HTMLelement("object") }}, {{ HTMLelement("param") }}, {{ HTMLelement("select") }}, and {{ HTMLelement("textarea") }}.

- -
-

需要注意的是,name 属性在其他类型元素上不存在。它不是 {{domxref("Element")}} 或 {{domxref("HTMLElement")}} 接口的一个属性。

-
- -

Name 可被使用于 {{ domxref("document.getElementsByName()") }} 方法,form 以及 the form elements collection。当使用于表单(form)或表单元素(form elements collection)时,可能返回一个单独的元素或一个元素集合。

- -

语法

- -
HTMLElement.name = string;
-var elName = HTMLElement.name;
-
-var fControl = HTMLFormElement.elementName;
-var controlCollection = HTMLFormElement.elements.elementName;
-
- -

例子

- -
<form action="" name="formA">
-  <input type="text" value="foo">
-</form>
-
-<script type="text/javascript">
-
-  // 获取表单中第一个元素的引用
-  var formElement = document.forms['formA'].elements[0];
-
-  // 设置一个 name
-  formElement.name = 'inputA';
-
-  // 显示 input 的 value 值
-  alert(document.forms['formA'].elements['inputA'].value);
-
-</script>
-
- -

备注

- -

在 IE6 中,使用 {{domxref("document.createElement()")}} 方法创建的 DOM 对象的 name 属性不能被更改。

- -

规范

- -

W3C DOM 2 HTML Specification:

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