原生js添加和删除类: this.className +=" "; this.className = this.className.replace(" 原来的类","替换后的类"); 转载于:https://www.cnblogs.com/freddyhuang/p/5562450.html