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";
 }
Richard JP Le Guen
28.8k8 gold badges94 silver badges121 bronze badges
asked Jan 20, 2010 at 19:16

2 Answers 2

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

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

answered Jan 20, 2010 at 19:25
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)
answered Jan 20, 2010 at 19:26

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.