单选多个div

 var divs=document.getElementsByClassName("neirong4_1_red");
 if(divs.length>0){
  for(var i=0;i<divs.length;i++){
   if(divs[i].id!=idn){
    document.getElementById(divs[i].id).setAttribute('class','neirong4_1');
   }
     }
 }
 obj.setAttribute('class','neirong4_1_red');

原文地址:https://www.cnblogs.com/liujie-e2/p/7683536.html