为什么这样设置属性没效果
function a(obj1){
var x=obj1.innerHTML;
var y=document.getElementsByTagName("div");
switch(x){
case "房产":
y[1].setAttribute("display","none");
//y[2].display="none";y[0].display="block";
break;
case "家居":
y[0].display="none";y[2].display="none";y[1].display="block";
alert("2");
break;
case "二手房":
y[1].display="none";y[0].display="none";y[2].display="block";
alert("3");
break;
default:alert("4");break;
}
}