F Da Costa wrote:
Ivo wrote: "F Da Costa" wrote
Small question re the use of an Array.
I'v got an array with x rowObjects in it.
When i get it the type of the container is Array and i can get a hold of
the objects just fine.
owever, how do i get the length of the array?
For container.length does not seem to work.
You have misspelled the word length as lenght. Happens all the time.
Or provide some clues by showing us some code.
Point wel taken. Unfortunately there was no typo.
To make matters worse. When using the Venkman debugger the content of
the object (of type Array) showed the two HtmlRowTableElements just fine
and the parameter length said 0.
Following the code:
...
var ch = getChildSegments(segment, 1);
if (ch.length>0)
displayDirectChildren(ch, onOff);
...
ch is filled correctly as verified in the debugger, breakpoint on the if
line.
The displayDirectChildren function is correct because this line is the
last one in that particular function (recursive call).
TIA
Fermin DCG
ch can exist such that (ch.constructor == Array) evaluates to true, it can
contain information you have placed in it, and still have ch.length == 0.
var a = new Array();
a["a"] = "a";
a["b"] = "b";
alert(a.length);
Without knowing how you are populating ch, it's difficult to tell if this is
the problem or not. For example, you may be doing:
var tableRows = new Array();
tableRows["row0"] = row0;
tableRows["row1"] = row1;
// etc
return tableRows;
In which case, tableRows.length will most certainly be 0.
--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ -
http://jibbering.com/faq