Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Node.hasAttributes

已废弃 Gecko 22 (Firefox 22 / Thunderbird 22 / SeaMonkey 2.19)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

概述

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

语法

result = targetNode.hasAttributes();

示例

var t1 = document.getElementById("table-data"); 

if ( t1.hasAttributes() ) { 
  // 可以用t1.attributes来读取该元素的所有属性
}

规范

文档标签和贡献者

 此页面的贡献者: ziyunfei, teoli, xuancanh, Xiaobian
 最后编辑者: xuancanh,