JS中的dom的属性操作

在js中,

  1. setAttribute(" " , " ")(可以用来设置元素节点的属性)
  2. getAttribute(" ")(可以得到元素节点的某个属性)
  3. 也可以直接使用 document.getElementById(“img”).src(属性名)直接获取属性或者赋值属性

猜你喜欢

转载自blog.csdn.net/syl2850246/article/details/82778884