getAttribute //获取节点的属性值
    setAttribute //设置节点的属性值
    removeAttribute //移除节点的属性

    1. <p id="p" class="one">hello world</p>
    2. <script>
    3. var p = document.getElementById("p");
    4. p.onclick = function(){
    5. this.setAttribute("style","display:none")
    6. }
    7. console.log(p.getAttribute("class"))
    8. console.log(p.removeAttribute("class"))
    9. </script>
    1. ![test9.gif](https://cdn.nlark.com/yuque/0/2019/gif/446381/1567259664960-99ed8e85-2451-4fad-a324-76fda93e22c5.gif#align=left&display=inline&height=250&name=test9.gif&originHeight=250&originWidth=215&size=20929&status=done&width=215)