Sorry for all these Javascript and DHTML questions. I'm learning right now and I don't have any really good reference material. I should probably pick up a good book... anyway... I have this function:
Basically this function draws a bar of a certain height when it receives an object. Anyway this does not work unless I change
the object in the setTimeout line to the actual name of the object (ie bar). The code then looks like this:
However, if I do this it means I can't use the function as a generic enlarge function for my other bar objects (i have five) and I need
separate enlarge functions for each one. The problem, I think, is that when the recurssion occurs the object goes out of scope. Can I solve this problem? Thanks
Code:
function enlarge(object)
{
if (object.style.pixelHeight <= ((m11[0])-Base)/Graphinc*Box)
{
object.style.pixelTop = object.style.pixelTop - 1;
object.style.pixelHeight = object.style.pixelHeight + 1;
}
setTimeout("enlarge1(object)",Speed);
}
Basically this function draws a bar of a certain height when it receives an object. Anyway this does not work unless I change
the object in the setTimeout line to the actual name of the object (ie bar). The code then looks like this:
Code:
function enlarge(object)
{
if (object.style.pixelHeight <= ((m11[0])-Base)/Graphinc*Box)
{
object.style.pixelTop = object.style.pixelTop - 1;
object.style.pixelHeight = object.style.pixelHeight + 1;
}
setTimeout("enlarge1(object)",Speed);
}
However, if I do this it means I can't use the function as a generic enlarge function for my other bar objects (i have five) and I need
separate enlarge functions for each one. The problem, I think, is that when the recurssion occurs the object goes out of scope. Can I solve this problem? Thanks