Node.hasAttributes概述hasAttributes属性返回一个布尔值true或false,来表明当前元素节点是否有至少一个的属性 (attribute).语法result = targetNode.hasAttributes(); 示例var t1 = document.getElementById("table-data"); if ( t1.hasAttributes() ) { // 可以用 t1.attributes 来读取该元素的所有属性 } 规范 hasAttributes