幫忙看看代碼 調(diào)用的add(id)代碼有錯嗎?
window.onload=function()
{
var lis=document.getElementsByTagName("li");
for(var i=0;i<lis.length;i++)
{
lis[i].onmouseover=function()
{
var u=this.getElementsByTagName("ul")[0];
if(u!=undefined)
{
u.style.display="block";
add(u.id);
}
}
lis[i].onmouseout=function()
{
var u=this.getElementsByTagName("ul")[0];
if(u!=undefined)
{
add(u.id);
}
}
}
function add(id)
{
var adda=document.getElementsById(id);
var h=adda.offsetHeight;
h+=1;
if(h<300)
{
adda.style.height=h+"px";
setTimeout("adda(id)",10);
}
else
{
return;
}
}
function sub(id)
{
setTimeout();
}
}
2017-01-07
function add(id)
{
var adda=document.getElementsById(id);
var h=adda.offsetHeight;
h+=1;
if(h<300)
{
adda.style.height=h+"px";
setTimeout("adda(id)",10);
? setTimeout("adda('"+id+"')",10);
}
else
{
return;
}
}
2016-07-31
定時函數(shù)有問題