在html5中增加了classList
document.getElementById("button").classList.add(“active”);
document.getElementById("button").classList.remove("active");
js给元素添加或者删除class
原文:https://www.cnblogs.com/manong-xxf/p/11428168.html