时间:2021-07-01 10:21:17 帮助过:185人阅读
//element:需要添加新样式的元素,value:新的样式
function addClass(element, value ){
if (!element.className){
element.className = value;
}else {
newClassName = element.className;
newClassName+= " ";
newClassName+= value ;
element.className = newClassName;
}
}