添加: obj.classList.add("active");
刪除:obj.classList.remove("active");
例子
<button class="btn1 btn2">點擊</button>
<script>
var btn=document.querySelector(".btn1");
btn.onclick=function(){
this.classList.remove("btn2")
}
</script>
