function $(obj){
return document.getElementById(obj);
}

function tree(asc){
//asc 点击的div的Id
//current  标示是否点击过,并存储点击的div的id。
// divId  二级菜单id 
// clicks 当为空的时候是没点击过的。  clicks不为空的时候是点击过的。
var current = $("current").value;
var divId = asc+"_t1";
var clickbs = "clicks_"+asc;
var clickvalue = $(clickbs).value;

if(current==""){                  //第一次点击菜单
$(asc).style.backgroundImage = "url(images/treebj_1.gif)";
$(divId).style.display = "block";
$(clickbs).value  = 1;
$("current").value = asc;
}else if(current==asc){           //当重复点击相同菜单的时候
if(clickvalue ==""){
$(current).style.backgroundImage = "url(images/treebj.gif)";
$(asc).style.backgroundImage = "url(images/treebj_1.gif)";
$(divId).style.display = "block";
$(clickbs).value  = 1;
$("current").value = asc;

}else{
$(current+"_t1").style.display = "none";
$(current).style.backgroundImage = "url(images/treebj.gif)";
$(clickbs).value  = "";
$("current").value = asc;
}
}else if(clickvalue==""){             //当不相同的时候 判断是否以前点击过。 这里是没有点击过。
$(current).style.backgroundImage = "url(images/treebj.gif)";
$(asc).style.backgroundImage = "url(images/treebj_1.gif)";
$(divId).style.display = "block";
$(clickbs).value  = 1;
$("current").value = asc;
}else{                           //这里是点击过。

$(divId).style.display = "none";
$(clickbs).value  = "";
$("current").value = current;
}


}就是这段代码,只在ie6中报错。 其他浏览器没问题。