"VK" <> writes:
> The myObject.length property is set properly
> only for an array which you have declared
> by using var myObject = new Array() or by
> var myObject = [item1, item2, item3]
That is, for an array, no matter how it is instantiated (not
"declared").
> and only if you're using positive integers for identifiers.
(within the range 0..2^32-2)
> If some of your identifiers are strings, they will not be counted
> to the myObject.length.
Incorrect. The parameter of the square bracket notation is always
converted to a string. If that string is a 32 bit integer in canonical
form (i.e., a valid array index), then assigning might change the
length property of the array. (Canonical form here means no initial
zeros, decimal point or exponential notation, so "1" is an array index
while "01", "1.0" and "1E+0" are not).
> In the particular, all form values come
> to the function as strings.
What function? The value property of form controls are strings.
> So even if your textField.value contains
> a number, it will be treated as a string. So to ensure that
> myObject.length
> is set properly, you should do at the least:
> var myObject[+Identifier] = IdentifierValue;
Not necessary if the string is the canonical representation of an
appropriate integer.
/L
--
Lasse Reichstein Nielsen -
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'