多个A标签,选中,未选中的显示问题

第一步: Jsp 

 

<c:choose><c:when test="${cityId==21 }"><a href="javascript:;"  id="area0">全部</a><a href="javascript:;"   id="area20">静安</a><a href="javascript:;"    id="area21">卢湾</a><a href="javascript:;"    id="area22">黄浦</a><a href="javascript:;"  id="area23">徐汇</a><a href="javascript:;"  id="area24">长宁</a><a href="javascript:;"  id="area25" >浦东</a><a href="javascript:;"   id="area26">虹口</a><a href="javascript:;"   id="area27">杨浦</a><a href="javascript:;"   id="area28" >普陀</a><a href="javascript:;"  id="area29">闵行</a><a href="javascript:;"  id="area30">闸北</a><a href="javascript:;"  id="area31">宝山</a><a href="javascript:;"  id="area32">嘉定</a><a href="javascript:;"  id="area33">松江</a><a href="javascript:;"  id="area34">南汇</a><a href="javascript:;"  id="area35">奉贤</a><a href="javascript:;"  id="area36">金山</a><a href="javascript:;"  id="area37">青浦</a><a href="javascript:;"  id="area38">崇明</a></c:when>

     <c:otherwise><a href="javascript:;"    id="area0">全部</a><a href="javascript:;"  id="area1">海淀</a><a href="javascript:;"    id="area2">朝阳</a><a href="javascript:;"  id="area3">东城</a><a href="javascript:;"  id="area4">西城</a><a href="javascript:;"  id="area5">崇文</a><a href="javascript:;"  id="area6">宣武</a><a href="javascript:;"  id="area7">丰台</a><a href="javascript:;"    id="area9">房山</a><a href="javascript:;"   id="area10">门头沟</a><a href="javascript:;"   id="area11">通州</a><a href="javascript:;"   id="area12">顺义</a><a href="javascript:;"   id="area13">昌平</a><a href="javascript:;"   id="area14">密云</a><a href="javascript:;"   id="area15">怀柔</a><a href="javascript:;"   id="area16">延庆</a><a href="javascript:;"   id="area17">平谷</a><a href="javascript:;"   id="area18">大兴</a></c:otherwise></c:choose>

第二步:js 

 

function changeArea (areaId) {

changeAreaClassName(areaId);

 

function changeAreaClassName(id){

  document.getElementById("area"+id).className=" current ";

      for(var i=0;i<100;i++){

      if(i != id && document.getElementById("area"+i)!=null){

      document.getElementById("area"+i).className=" otherCur ";

      }

      }

   }

 

 

 第三步 : css

<style>

a.otherCur {

    color: #FFFFFF;

}

.tj_tit a.current {
     color #444444 ;
}

</style>