HTML DOM hasAttributes 方法

[

HTML DOM hasAttributes() 方法
元素对象

实例

查看body元素是否有任何属性


	document.body.hasAttributes()

输出结果:


false

定义和用法

hasAttributes() 方法如果某节点有任何属性时返回 true,否则返回 false。

浏览器支持

所有主要浏览器都支持 hasAttributes 方法
注意: Internet Explorer 8 及 IE 更早版本不支持该方法。

语法

node.hasAttributes()

参数

None

返回值

类型 描述
Boolean 如果节点有属性返回 true,否则返回false
]
转载请保留页面地址:https://www.breakyizhan.com/html/21525.html
原文地址:https://www.cnblogs.com/breakyizhan/p/13286372.html