From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../zh-cn/web/api/element/hasattributes/index.html | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 files/zh-cn/web/api/element/hasattributes/index.html (limited to 'files/zh-cn/web/api/element/hasattributes') diff --git a/files/zh-cn/web/api/element/hasattributes/index.html b/files/zh-cn/web/api/element/hasattributes/index.html new file mode 100644 index 0000000000..bb4b6b2256 --- /dev/null +++ b/files/zh-cn/web/api/element/hasattributes/index.html @@ -0,0 +1,23 @@ +--- +title: Node.hasAttributes +slug: Web/API/Element/hasAttributes +translation_of: Web/API/Element/hasAttributes +--- +
+ {{ApiRef}}
+
+ {{ obsolete_header(22) }}
+

概述

+

hasAttributes属性返回一个布尔值truefalse,来表明当前元素节点是否有至少一个的属性(attribute).

+

语法

+
result = targetNode.hasAttributes();
+

示例

+
var t1 = document.getElementById("table-data");
+
+if ( t1.hasAttributes() ) {
+  // 可以用t1.attributes来读取该元素的所有属性
+}
+

规范

+ -- cgit v1.2.3-54-g00ecf