0

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";
 }

2 Answers 2

5
setTimeout(function() { Tableslide_down(content, height); },10);

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

Sign up to request clarification or add additional context in comments.

1 Comment

+1 Every time you construct code from strings Jon Skeet kills a kitten.
0

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.