Просмотр полной версии : Длинна ассоциативного массива, КАК ?
netstuff
06.08.2002, 12:28
не могу понять, как бы мне извлечь количество элементов ассоциативного массива :(
netstuff
06.08.2002, 13:00
не катит :(
Property; contains the length of the array. This property is automatically updated when new elements are added to the array. When you assign a value to an array element (for example, myArray[index] = value), if index is a number, and index+1 is a greater than the length property, the length property is updated to index + 1.
Что же мне делать?
Object.prototype.addProperty("__length__", function () {
var count = 0;
for (var i in this) {
count++;
}
return count;
}, null);
ASSetPropFlags(Object.prototype,"__length__",7,1)
obj = new Object();
obj.a = 1;
obj.b = 2;
obj.c = 3;
trace(obj.__length__) // 3
netstuff
06.08.2002, 16:23
2 ishASSetPropFlags(Object.prototype,"__length__",7,1)
чего за функция? недокументированная?
netstuff
06.08.2002, 16:39
благодаря твоему коду нашел замес:
было:
for(var i=0; i<element.attributes.length; i++) {....
стало:
for(var i in element.attributes) {
работает
netstuff,
а пришли исходник ???
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.