Reputation: 29
Can any one tell me why i am loosing content in setTimeout checked in firebug and i am loosing the content, though i the height of the content is showing! all replies are welcome!
function Tableslide_down(content,height)
{
var contentID = document.getElementById(content);
if(contentID.offsetHeight < height)
{
contentID.style.top = parseInt(slidingDiv.style.top) + 10 + "px";
setTimeout("Tableslide_down('"+content+"','"+height+"')",10);
}
contentID.style.display = "block";
}
Upvotes: 0
Views: 165
Reputation: 11211
Try assigning the timeout to a variable:
var myto = setTimeout("Tableslide_down('"+content+"','"+height+"')",10);
This also means you can clear it later if you need to:
clearTimeout(myto)
Upvotes: 0
Reputation: 5310
setTimeout(function() { Tableslide_down(content, height); },10);
First parameter of setTimeout can (MUST) be a function.
Upvotes: 5