单选多个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');

posted @ 2017-10-17 19:47  liujiee2  阅读(133)  评论(0编辑  收藏  举报