创建隐藏的菜单
/**
*创建隐藏的菜单 yu jian
*************************
*arraySub: 子菜单的VALUE array数组;
*aSubs: 子菜单的链接 array数组;
*id: 父菜单的ID;
*id: select的id
*/
var SubHead=Class.create();
SubHead.prototype = {
initialize:function(arraySub,aSubs,id,_id){
this.arraySub=arraySub;
this.id=document.getElementById(id);
this.aSubs=aSubs;
this.isDis=false;
this._id=document.getElementById(_id);
if(_id){
this._id.οnclick=this.doClick.bindAsEventListener(this);
}
else{
this.id.οnclick=this.doClick.bindAsEventListener(this);
}
this.makeDiv();
this.createSub();
},
makeDiv: function(){//在此设置该div样式
this.subDiv=document.createElement("div");
this.subDiv.className="yuy"
this.id.appendChild(this.subDiv);
},
doClick:function () {
if(this.isDis)this.isDis=false;
else this.isDis=true;
this.showSub();
},
showSub:function(){
if(this.isDis){
this.subDiv.style.display="";
}
else{
this.subDiv.style.display="none"
}
},
createSub:function(){
this.subDiv.style.display="none";
var divs=new Array(this.arraySub.length);
for(var i=0;i<this.arraySub.length;i++){
divs[i]=document.createElement("div");
divs[i].innerHTML='<img src="../../../../lib/images/group/arrow.gif" width="3" height="5">'+'<a '+'href='+this.aSubs[i]+'>'+this.arraySub[i]+'</a>';
this.subDiv.appendChild(divs[i]);
}
}
}