点击按钮来查看 button 元素拥有多少属性。

结果应该是 2(button 元素的 id 和 onclick 属性)。

注释:Internet Explorer 8 以及更早的版本中,attributes 属性将返回元素所有可能的属性的集合,在本例中,会返回大于 2 的数字。