关于getAttribute()和setAttribute()方法

xiaoxiao2021-02-28  87

setAttribute()方法与它们有一个本质上的区别:它允许我们对属性节点的值做出修改。

类似于getAttribute()方法,setAttribute()方法也是一个只能通过元素节点对象调用的函数,但setAttribute()方法需要我们向它传递两个参数:

getAttribute()方法不能通过document对象调用,这与我们此前介绍过的其他方法不同。我们只能通过一个元素节点对象调用它。

转载请注明原文地址: https://www.6miu.com/read-84960.html

最新回复(0)