I need to create dynamically an Array, but i really can't find a solution...
Basically what i need : An id linked with a type and the number of items in it. Then for each id i need to add a variable number of item.
So the final example have to be like this :
id : 59 | type : combo_box | NbItem : 1
Item 1
name : text | value : test
name : icon | value : test.png
id : 60 | type : search_box | NbItem : 2
Item 1
name : text | value : Yahoo
name : icon | value : yahoo.png
name : weblink | value : yahoo.com
Item 2
name : text | value : Bing
name : icon | value : Bing.png
name : weblink | value : Bing.com
I precise once again that it have to be dynamic. I need to add during the execution, like array[60][name][0] = text
EDIT
I'm trying to proceed like this, but it fail :
var dropMenuArray;
var node = XMLDoc.getElementsByTagName("item")[itemCpt].getElementsByTagName("m_type")[0];
type = node.childNodes[0].nodeValue;
node = XMLDoc.getElementsByTagName("item")[itemCpt].getElementsByTagName("m_id")[XMLDoc.getElementsByTagName("item")[itemCpt].getElementsByTagName("m_id").length-1];
id = node.childNodes[0].nodeValue;
if ((type.indexOf('combo_button') != -1 && type.indexOf('combo_button_item') == -1) || type.indexOf('search_box') != -1) {
dropMenuArray[id] = {
Type: type,
items: []
};
alert('Index : ' + id + ' - Type : ' + type);
}
I mean no alert, and when i put the array creation on commantary i have the alert popup.
var dropMenuArray = [ ];