tags:

views:

59

answers:

2

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";
 }
+4  A: 
setTimeout(function() { Tableslide_down(content, height); },10);

First parameter of setTimeout can (MUST) be a function.

OcuS
+1 Every time you construct code from strings Jon Skeet kills a kitten.
slebetman
A: 

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)
graphicdivine