原生JS 添加或者删除某个class

$S.addHandler($S.getId(fav[i]),'mouseover',function(){
                this.className += " "+'S_hover';
            });
            $S.addHandler($S.getId(fav[i]),'mouseout',function(){
                var reg = new RegExp('(\s|^)'+'S_hover'+'(\s|$)');
                this.className=this.className.replace(reg,' ');
            });

原文地址:https://www.cnblogs.com/afei-happy/p/4288660.html