Home  >  Q&A  >  body text

getAttribute()和setAttribute()还是有点搞不清

getAttribute()和setAttribute()还是有点搞不清

汪汪汪汪2862 days ago1241

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-09-30 22:56:45

    getAttribute() and setAttribute() are still a bit confusing - PHP Chinese website Q&A - getAttribute() and setAttribute() are still a bit confusing - PHP Chinese website Q&A

    Take a look around and learn.

    reply
    0
  • 阿神

    阿神2016-12-19 14:33:57

    getAttribute(name)

    是读,从已有的属性值中读取

    setAttribute(name,value)

    是写,有两个参数,先根据第一个参数查找当前元素是否有‘name’属性,如果没有就添加一个‘name’属性,然后再将第二个参数值赋给名为第一个参数值‘name’的属性

    reply
    0
  • Cancelreply