mouseover在二级菜单上 为什么会抖
for(var i=0;i<Lis.length;i++)
{ Lis[i].onmouseover=function (){
var u = this.getElementsByTagName("ul")[0];
u.style.display = "block";
if (u != undefined) {
ChangeH(u.id,1);
}
}
Lis[i].onmouseout = function () {
var u = this.getElementsByTagName("ul")[0];
if (u != undefined) {
ChangeH(u.id,-1);
}
}
}
}
function ChangeH(id, count) {
// 根据ID找到ulList,同时得到其高度
var ulList = document.getElementById(id);
var h = ulList.offsetHeight;
h += count;
if (count > 0) {
if (h <= 42) {
// 将高度赋值给ulList,同时,不断调用本函数
ulList.style.height = h + "px";
setTimeout("ChangeH('" + id + "',1)", 10);
}
else {
return;
}
}
else {
if (h > 0) {
// 将高度赋值给ulList,同时,不断调用本函数
ulList.style.height = h + "px";
setTimeout("ChangeH('" + id + "',-1)", 10);
}
else {
ulList.style.display = "none";
return;
}
}
}