js我想让当鼠标自动移开或点击其他地方的时候,关闭下拉菜单。
functionbar_onmouseover(obj,type,cmd){for(vari=1;i<mnuPrev.length;i++){if(mnuPrev[i]....
function bar_onmouseover(obj,type,cmd) {
for (var i=1;i<mnuPrev.length;i++) {
if(mnuPrev[i].id==obj.parentElement.id) {
for (var j=i+1;j<mnuPrev.length;j++) {
if (mnuPrev[j].type==0) {
document.all.item(mnuPrev[j].id + "_ico").className = "ico";
document.all.item(mnuPrev[j].id + "_text").className = "text";
document.all.item(mnuPrev[j].id + "_skey").className = "skey";
document.all.item(mnuPrev[j].id + "_sub").className = "sub";
}else {
document.all.item(mnuPrev[j].id).style.visibility = "hidden";
}
}
mnuPrev.length = i + 1;
break;
}
}
mnuPrev[mnuPrev.length] = new menuinfo(obj.id,0);
document.all.item(obj.id + "_ico").className = "icoOver";
document.all.item(obj.id + "_text").className = "textOver";
document.all.item(obj.id + "_skey").className = "skeyOver";
document.all.item(obj.id + "_sub").className = "subOver";
if (type==0) { showSubMenu(obj,cmd); }
}
function bar_onmouseout(obj,type,cmd) {
if (type!=0) {
document.all.item(obj.id + "_ico").className = "ico";
document.all.item(obj.id + "_text").className = "text";
document.all.item(obj.id + "_skey").className = "skey";
document.all.item(obj.id + "_sub").className = "sub";
if (mnuPrev.length>0) {
mnuPrev.length --;
}
}
} 展开
for (var i=1;i<mnuPrev.length;i++) {
if(mnuPrev[i].id==obj.parentElement.id) {
for (var j=i+1;j<mnuPrev.length;j++) {
if (mnuPrev[j].type==0) {
document.all.item(mnuPrev[j].id + "_ico").className = "ico";
document.all.item(mnuPrev[j].id + "_text").className = "text";
document.all.item(mnuPrev[j].id + "_skey").className = "skey";
document.all.item(mnuPrev[j].id + "_sub").className = "sub";
}else {
document.all.item(mnuPrev[j].id).style.visibility = "hidden";
}
}
mnuPrev.length = i + 1;
break;
}
}
mnuPrev[mnuPrev.length] = new menuinfo(obj.id,0);
document.all.item(obj.id + "_ico").className = "icoOver";
document.all.item(obj.id + "_text").className = "textOver";
document.all.item(obj.id + "_skey").className = "skeyOver";
document.all.item(obj.id + "_sub").className = "subOver";
if (type==0) { showSubMenu(obj,cmd); }
}
function bar_onmouseout(obj,type,cmd) {
if (type!=0) {
document.all.item(obj.id + "_ico").className = "ico";
document.all.item(obj.id + "_text").className = "text";
document.all.item(obj.id + "_skey").className = "skey";
document.all.item(obj.id + "_sub").className = "sub";
if (mnuPrev.length>0) {
mnuPrev.length --;
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询