...

View Full Version : find in Array?



loco_ola
03-09-2005, 01:34 PM
I have an array like so which i have converted from a vbArray:

arrayDrinks[0][0] = "11"
arrayDrinks[0][1] = "15"
arrayDrinks[1][0] = "SOme wine|some other wine|more red|extra red"
arrayDrinks[1][1] = "Stella|Kronenburg"

i basically want to able to reference the row in the array by id in arrayDrinks[0][i]

instead of writing arrayDrinks[0][0] for id 11 i want to be able to reference it directly to id 11.

obviously i could loop through my results to find the correct id in the array, but there will be thousands of items in the array eventually and its not really very efficient.

IS this possible at all. thanks

Kor
03-09-2005, 03:56 PM
I guess your information you have bring it is not very clear, at least not for me... Which id? What do you intend to do?

To retrieve a cell in a table you may use

document.getElementById('tableid').getElementsByTagName('td')[cellsindex]
but you may circle also through the rows... or directly through the inner elements... it depends on.... What is your goal, after all?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum