getAttribute //获取节点的属性值
setAttribute //设置节点的属性值
removeAttribute //移除节点的属性
<p id="p" class="one">hello world</p>
<script>
var p = document.getElementById("p");
p.onclick = function(){
this.setAttribute("style","display:none")
}
console.log(p.getAttribute("class"))
console.log(p.removeAttribute("class"))
</script>
![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)