function choose(id){ document.getElementById("typeid").value = id; //var infoa=document.getElementById("info_"+id); //infoa.style.color = '#ff0000'; var a=document.getElementsByTagName("a"); for(var i=0;i<a.length;i++){ if(a[i].id==id){ a[i].style.color='#FF0000'; }else{ a[i].style.color = '#0357cc'; } } }
一组a标签只改变点击的颜色
var a=document.getElementsByTagName("a"); for(var i=0;i<a.length;i++){ if(a[i].id==id){ a[i].style.color='#FF0000'; }else{ a[i].style.color = '#0357cc'; } }
//var infoa=document.getElementById("info_"+id); //infoa.style.color = '#ff0000';