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";
}
Richard JP Le Guen
28.8k8 gold badges94 silver badges121 bronze badges
2 Answers 2
setTimeout(function() { Tableslide_down(content, height); },10);
First parameter of setTimeout can (MUST) be a function.
answered Jan 20, 2010 at 19:25
OcuS
5,3203 gold badges39 silver badges46 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
slebetman
+1 Every time you construct code from strings Jon Skeet kills a kitten.
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)
answered Jan 20, 2010 at 19:26
graphicdivine
11.3k7 gold badges36 silver badges60 bronze badges
Comments
lang-js