84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
为什么这里不能通过getAttribute()方法获取nodeName属性值?
Why can’t the nodeName attribute value be obtained through the getAttribute() method here? -PHP Chinese website Q&A-Why can't the nodeName attribute value be obtained through the getAttribute() method here? -PHP Chinese website Q&A
Please watch and learn.
getAttribute()方法只能获取元素中已存在属性的属性值,而nodeName是每一个节点自带的静态属性而不是我们自己定义的属性,所以不能使用getAttribute()方法获取nodeName属性值
例如:<p class="message" id="text" width="200px" height="50px">这是一个p标签</p>
我们可以使用getAttribute()方法获取class、id、width、height等属性的属性值,但不可以使用getAttribute()方法获取nodeName属性值,因为我们没用写一个className属性
Why can’t the nodeName attribute value be obtained through the getAttribute() method here? -PHP Chinese website Q&A-Why can't the nodeName attribute value be obtained through the getAttribute() method here? -PHP Chinese website Q&A
Please watch and learn.
getAttribute()方法只能获取元素中已存在属性的属性值,而nodeName是每一个节点自带的静态属性而不是我们自己定义的属性,所以不能使用getAttribute()方法获取nodeName属性值
例如:<p class="message" id="text" width="200px" height="50px">这是一个p标签</p>
我们可以使用getAttribute()方法获取class、id、width、height等属性的属性值,但不可以使用getAttribute()方法获取nodeName属性值,因为我们没用写一个className属性